Suspend trigger during system data import

This commit is contained in:
D. Berge
2020-09-30 15:39:37 +02:00
parent 19db65c999
commit 3c1a5da1a8

View File

@@ -31,6 +31,7 @@ if __name__ == '__main__':
print(f'Survey: {survey["id"]} ({survey["schema"]})')
db.set_survey(survey["schema"])
with db.conn.cursor() as cursor:
cursor.execute("SET session_replication_role = replica;")
try:
pathPrefix = survey["exports"]["machine"]["path"]
@@ -49,6 +50,7 @@ if __name__ == '__main__':
# If we don't commit the data does not actually get copied
db.conn.commit()
cursor.execute("SET session_replication_role = DEFAULT;")
# Update the sequences that generate event ids
cursor.execute("SELECT reset_events_serials();")
# Let us ensure events_timed_seq is up to date, even though