about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-05-30 13:48:55 -0500
committerFrederick Muriuki Muriithi2025-05-30 13:48:55 -0500
commit9ac2a0adcc8170a476e4bfb9c3d0222f1b5566e2 (patch)
treef4c6e48507af1411b717b5a381bfdc1e8f6d53ba /scripts
parent0c788d4fd42b00ad9d098921358e6e4cd5d3ac62 (diff)
downloadgn-uploader-9ac2a0adcc8170a476e4bfb9c3d0222f1b5566e2.tar.gz
Fix query: Add missing field and parameter.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/load_phenotypes_to_db.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/load_phenotypes_to_db.py b/scripts/load_phenotypes_to_db.py
index 3ead245..5ccb5c6 100644
--- a/scripts/load_phenotypes_to_db.py
+++ b/scripts/load_phenotypes_to_db.py
@@ -209,12 +209,17 @@ def cross_reference_phenotypes_publications_and_data(
     with conn.cursor(cursorclass=DictCursor) as cursor:
         cursor.execute("SELECT MAX(Id) CurrentMaxId FROM PublishXRef")
         _nextid = int(cursor.fetchone()["CurrentMaxId"]) + 1
-        cursor.execute(
-            ("INSERT INTO PublishXRef(Id, InbredSetId, PhenotypeId, PublicationId, DataId) "
-             "VALUES(%(xref_id)s, %(population_id)s, %(phenotype_id)s, %(data_id)s) "
+        cursor.executemany(
+            ("INSERT INTO PublishXRef("
+             "Id, InbredSetId, PhenotypeId, PublicationId, DataId, comments"
+             ") "
+             "VALUES ("
+             "%(xref_id)s, %(population_id)s, %(phenotype_id)s, "
+             "%(publication_id)s, %(data_id)s, 'Upload of new data.'"
+             ") "
              "RETURNING *"),
             tuple({**row, "xref_id": _id}
-                  for _id, row in enumerate(xref_data, start=_next_id)))
+                  for _id, row in enumerate(xref_data, start=_nextid)))
         return tuple(dict(row) for row in cursor.fetchall())
     return tuple()