From 3f980e5dde3f84c7c112800900efcef9b381511b Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 24 Jun 2025 15:37:23 -0500 Subject: 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. --- uploader/phenotypes/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'uploader/phenotypes/models.py') 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 " -- cgit v1.2.3