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:
D. Berge
2020-09-23 15:46:17 +02:00
parent 6bab21bce4
commit 97104556b7

View File

@@ -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()