mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 09:27:07 +00:00
Do not hard fail if imports fail for one project.
It may be the case that we have already re-imported some of the data, so we just move on to the next project.
This commit is contained in:
@@ -9,7 +9,7 @@ import os
|
||||
from glob import glob
|
||||
import configuration
|
||||
import preplots
|
||||
from datastore import Datastore
|
||||
from datastore import Datastore, psycopg2
|
||||
|
||||
exportables = [
|
||||
"events_seq",
|
||||
@@ -38,11 +38,14 @@ if __name__ == '__main__':
|
||||
print("Survey does not define an export path for machine data")
|
||||
continue
|
||||
|
||||
try:
|
||||
for table in exportables:
|
||||
path = os.path.join(pathPrefix, table)
|
||||
print(" ← ", path, " → ", table)
|
||||
with open(path, "rb") as fd:
|
||||
cursor.copy_from(fd, table);
|
||||
except psycopg2.errors.UniqueViolation:
|
||||
print("It looks like data for this survey may have already been imported (unique constraint violation)")
|
||||
|
||||
# If we don't commit the data does not actually get copied
|
||||
db.conn.commit()
|
||||
|
||||
Reference in New Issue
Block a user