From b2cd7e9d929a5417673d6c9dcfa04c6272db2aa6 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 13 Apr 2021 08:21:47 +0300 Subject: Add method for inserting phenotypes --- gn3/db/traits.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gn3/db/traits.py b/gn3/db/traits.py index 5ac342f..6c6118a 100644 --- a/gn3/db/traits.py +++ b/gn3/db/traits.py @@ -48,3 +48,11 @@ def insert_publication(pubmed_id: int, publication: Optional[Dict], ", ".join(['%s'] * len(publication)))) with conn.cursor() as cursor: cursor.execute(insert_query, tuple(publication.values())) + + +def insert_phenotype(phenotype: Optional[Dict], conn: Any): + insert_query = ("INSERT into Phenotype (%s) Values (%s)" % + (", ".join(phenotype.keys()), + ", ".join(['%s'] * len(phenotype)))) + with conn.cursor() as cursor: + cursor.execute(insert_query, tuple(phenotype.values())) -- cgit v1.2.3