mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 07:37:08 +00:00
Delete online data before importing sequence.
The deferred import routing will delete any online data for any raw sequences that it imports.
This commit is contained in:
@@ -137,7 +137,7 @@ class Datastore:
|
||||
else:
|
||||
cur = cursor
|
||||
|
||||
qry = "SELECT * FROM files;"
|
||||
qry = "SELECT * FROM files WHERE hash NOT LIKE '*%';"
|
||||
cur.execute(qry)
|
||||
res = cur.fetchall()
|
||||
|
||||
@@ -235,6 +235,18 @@ class Datastore:
|
||||
hash = self.add_file(filepath, cursor)
|
||||
incr = records[0]["point_number"] <= records[-1]["point_number"]
|
||||
|
||||
# Start by deleting any online data we may have for this sequence
|
||||
# FIXME Factor this out into its own function
|
||||
qry = """
|
||||
DELETE
|
||||
FROM raw_lines rl
|
||||
USING raw_lines_files rlf
|
||||
WHERE
|
||||
rl.sequence = rlf.sequence
|
||||
AND rlf.hash = '*online*'
|
||||
AND rl.sequence = %s;
|
||||
"""
|
||||
|
||||
qry = """
|
||||
INSERT INTO raw_lines (sequence, line, remarks, ntbp, incr)
|
||||
VALUES (%s, %s, '', %s, %s)
|
||||
@@ -341,6 +353,20 @@ class Datastore:
|
||||
hash = self.add_file(filepath, cursor)
|
||||
incr = p111.point_number(records[0]) <= p111.point_number(records[-1])
|
||||
|
||||
# Start by deleting any online data we may have for this sequence
|
||||
# FIXME Factor this out into its own function
|
||||
qry = """
|
||||
DELETE
|
||||
FROM raw_lines rl
|
||||
USING raw_lines_files rlf
|
||||
WHERE
|
||||
rl.sequence = rlf.sequence
|
||||
AND rlf.hash = '*online*'
|
||||
AND rl.sequence = %s;
|
||||
"""
|
||||
|
||||
cursor.execute(qry, (fileinfo["sequence"],))
|
||||
|
||||
qry = """
|
||||
INSERT INTO raw_lines (sequence, line, remarks, ntbp, incr)
|
||||
VALUES (%s, %s, '', %s, %s)
|
||||
|
||||
Reference in New Issue
Block a user