diff options
-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() |