diff options
author | BonfaceKilz | 2021-04-13 08:21:47 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-05-08 19:19:47 +0300 |
commit | b2cd7e9d929a5417673d6c9dcfa04c6272db2aa6 (patch) | |
tree | 3014c5c15a9fb43e344c5145a8440ca658d106ac /gn3/db | |
parent | 6ec8a5d1de6b6f0f84a76d0d52c77f3d96420479 (diff) | |
download | genenetwork3-b2cd7e9d929a5417673d6c9dcfa04c6272db2aa6.tar.gz |
Add method for inserting phenotypes
Diffstat (limited to 'gn3/db')
-rw-r--r-- | gn3/db/traits.py | 8 |
1 files changed, 8 insertions, 0 deletions
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())) |