for result in merge_results(generate_results()):
if isinstance(result, Pass):
cursor.execute(
- "insert into diskjumble.verify_pass values (default, %s, %s, %s)",
+ """
+ insert into diskjumble.verify_pass (verify_pass_id, at, disk_id, disk_sectors)
+ values (default, %s, %s, %s)
+ """,
(ts, disk_id, result.blocks)
)
else:
"""
with
new_piece as (
- insert into diskjumble.verify_piece
+ insert into diskjumble.verify_piece (verify_id, at, entity_id, piece)
values (default, %(ts)s, %(entity_id)s, %(piece_num)s)
returning verify_id
),
_ as (
- insert into diskjumble.verify_piece_content
+ insert into diskjumble.verify_piece_content (verify_id, seq, disk_id, disk_sectors)
select verify_id, ordinality - 1, %(disk_id)s, block_range
from
new_piece,
unnest(%(ranges)) with ordinality as block_range
)
- insert into diskjumble.verify_piece_fail
+ insert into diskjumble.verify_piece_fail (verify_id)
select verify_id from new_piece
""",
{