diff options
author | Frederick Muriuki Muriithi | 2025-05-30 13:48:55 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2025-05-30 13:48:55 -0500 |
commit | 9ac2a0adcc8170a476e4bfb9c3d0222f1b5566e2 (patch) | |
tree | f4c6e48507af1411b717b5a381bfdc1e8f6d53ba | |
parent | 0c788d4fd42b00ad9d098921358e6e4cd5d3ac62 (diff) | |
download | gn-uploader-9ac2a0adcc8170a476e4bfb9c3d0222f1b5566e2.tar.gz |
Fix query: Add missing field and parameter.
-rw-r--r-- | scripts/load_phenotypes_to_db.py | 13 |
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() |