aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-06-24 15:37:23 -0500
committerFrederick Muriuki Muriithi2025-06-24 15:37:23 -0500
commit3f980e5dde3f84c7c112800900efcef9b381511b (patch)
tree3d84b2e56e2b1f84d364e26a3ed5fba86e2b95f6
parentf23c2f21f97db6eb5141dfb2299450afe256b5be (diff)
downloadgn-uploader-3f980e5dde3f84c7c112800900efcef9b381511b.tar.gz
Use positional parameters rather than named ones.
Named parameters were causing problems on staging, where the names would be converted into bytestrings and then used to index into the dictionaries, leading to `KeyError` exceptions.
-rw-r--r--uploader/phenotypes/models.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/uploader/phenotypes/models.py b/uploader/phenotypes/models.py
index a6ee694..c2aeebf 100644
--- a/uploader/phenotypes/models.py
+++ b/uploader/phenotypes/models.py
@@ -315,8 +315,9 @@ def create_new_phenotypes(conn: mdb.Connection,
cursor.executemany(
("INSERT INTO "
"Phenotype(Pre_publication_description, Original_description, Units, Authorized_Users) "
- "VALUES (%(id)s, %(description)s, %(units)s, 'robwilliams')"),
- tuple(batch))
+ "VALUES (%s, %s, %s, 'robwilliams')"),
+ tuple((row["id"], row["description"], row["units"])
+ for row in batch))
paramstr = ", ".join(["%s"] * len(batch))
cursor.execute(
"SELECT * FROM Phenotype WHERE Pre_publication_description IN "