about summary refs log tree commit diff
path: root/uploader
diff options
context:
space:
mode:
Diffstat (limited to 'uploader')
-rw-r--r--uploader/publications/models.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/uploader/publications/models.py b/uploader/publications/models.py
index f36c800..37c1df6 100644
--- a/uploader/publications/models.py
+++ b/uploader/publications/models.py
@@ -1,7 +1,9 @@
 """Module to handle persistence and retrieval of publication to/from MariaDB"""
+from MySQLdb.cursors import DictCursor
 
 from gn_libs.mysqldb import Connection
 
+
 def fetch_phenotype_publications(
         conn: Connection,
         ids: tuple[tuple[int, int], ...]
@@ -40,15 +42,9 @@ def create_new_publications(
                  "Title=VALUES(Title), Journal=VALUES(Journal), "
                  "Volume=VALUES(Volume), Pages=VALUES(pages), "
                  "Month=VALUES(Month), Year=VALUES(Year) "
-                 "RETURNING "),
+                 "RETURNING *"),
                 publications)
-
-            paramstr = ", ".join(["%s"] * len(pubmed_ids))
-            cursor.execute(
-                ("SELECT Id, PubMed_ID FROM Publication "
-                 f"WHERE PubMed_ID IN ({paramstr})"),
-                pubmed_ids)
-            return {
-                row["PubMed_ID"]: row["Id"] for row in cursor.fetchall()
-            }
-        return {}
+            return tuple({
+                **row, "PublicationId": row["Id"]
+            } for row in cursor.fetchall())
+        return tuple()