From bc5aef5144ac2c298cb56478fe3bdf2fc387dfbb Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Mon, 24 May 2021 16:59:56 +0200 Subject: [PATCH] Run post-import functions after final lines. The reason why need to do it like this instead of relying on a trigger is because the entry in final_lines is created first and the final_shots are populated. If we first the trigger on final_lines it is not going to find any shots; if we fire it as a row trigger on final_shots it would try to label every point in sequence as it is imported; finally if we fire it as a statement trigger on final_shots we have no idea which sequence was imported. --- bin/datastore.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/datastore.py b/bin/datastore.py index df4e9dc..7291f75 100644 --- a/bin/datastore.py +++ b/bin/datastore.py @@ -479,6 +479,8 @@ class Datastore: if filedata is not None: self.save_file_data(filepath, json.dumps(filedata), cursor) + + cursor.execute("CALL final_line_post_import(%s);", (fileinfo["sequence"],)) self.maybe_commit()