diff options
author | zsloan | 2023-03-17 18:27:42 +0000 |
---|---|---|
committer | zsloan | 2023-03-17 18:27:42 +0000 |
commit | a1a376db4848a3ccd74c9c384efacea4579ce165 (patch) | |
tree | 5be02a6335e5e8d7a35f6597f30a111ab7dbe90f /gn3/db/sample_data.py | |
parent | 047e11c611977814e29f5b636c8583171bf579e3 (diff) | |
download | genenetwork3-a1a376db4848a3ccd74c9c384efacea4579ce165.tar.gz |
Add conn.commit() to queries in sample_data.py
Diffstat (limited to 'gn3/db/sample_data.py')
-rw-r--r-- | gn3/db/sample_data.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gn3/db/sample_data.py b/gn3/db/sample_data.py index 96168f1..4d8a14f 100644 --- a/gn3/db/sample_data.py +++ b/gn3/db/sample_data.py @@ -158,6 +158,7 @@ def update_sample_data( (f"UPDATE {table} SET {_val} = %s " f"WHERE {sub_query}"), (value, strain_id, data_id), ) + conn.commit() return cursor.rowcount return 0 @@ -185,6 +186,7 @@ def update_sample_data( "AND InbredSetId = %s", (value, strain_id, name, inbredset_id), ) + conn.commit() return cursor.rowcount return 0 @@ -264,6 +266,7 @@ def delete_sample_data( (f"DELETE FROM {table} " f"WHERE {sub_query}"), (strain_id, data_id), ) + conn.commit() return cursor.rowcount def __delete_case_attribute(conn, strain_id, case_attr, inbredset_id): @@ -285,6 +288,7 @@ def delete_sample_data( "AND InbredSetId = %s", (strain_id, name, inbredset_id), ) + conn.commit() return cursor.rowcount strain_id, data_id, inbredset_id = get_sample_data_ids( @@ -337,6 +341,7 @@ def insert_sample_data( ), (strain_id, data_id, value), ) + conn.commit() return cursor.rowcount return 0 @@ -367,7 +372,9 @@ def insert_sample_data( (strain_id, id_, value, inbredset_id), ) row_count = cursor.rowcount + conn.commit() return row_count + conn.commit() return 0 strain_id, data_id, inbredset_id = get_sample_data_ids( @@ -394,6 +401,7 @@ def insert_sample_data( "AND StrainId = %s", (data_id, strain_id), ) + conn.commit() if cursor.fetchone(): # Data already exists return count |