aboutsummaryrefslogtreecommitdiff
path: root/scripts/maintenance/Update_Case_Attributes_MySQL_tab.py
diff options
context:
space:
mode:
authorzsloan2022-03-22 19:02:15 +0000
committerzsloan2022-03-22 19:02:15 +0000
commita49da43ba00245cf23a2b72c314127986f567f28 (patch)
treece64e83370c52add94927bc050febf5d242722db /scripts/maintenance/Update_Case_Attributes_MySQL_tab.py
parent68ac19153b128f60b660e11365e5fd4304c95300 (diff)
parent32cb57b82db328bc84753af9d25e9aaa1bd31152 (diff)
downloadgenenetwork2-a49da43ba00245cf23a2b72c314127986f567f28.tar.gz
Merge remote-tracking branch 'origin/testing' into feature/add_rqtl_pairscan
Diffstat (limited to 'scripts/maintenance/Update_Case_Attributes_MySQL_tab.py')
-rw-r--r--scripts/maintenance/Update_Case_Attributes_MySQL_tab.py23
1 files changed, 9 insertions, 14 deletions
diff --git a/scripts/maintenance/Update_Case_Attributes_MySQL_tab.py b/scripts/maintenance/Update_Case_Attributes_MySQL_tab.py
index bf796df4..a3cd1c35 100644
--- a/scripts/maintenance/Update_Case_Attributes_MySQL_tab.py
+++ b/scripts/maintenance/Update_Case_Attributes_MySQL_tab.py
@@ -10,18 +10,13 @@ import time
import csv
########################################################################
-mydb = MySQLdb.connect(host='localhost',
- user='username',
- passwd='',
- db='db_webqtl')
-cursor = mydb.cursor()
+with MySQLdb.connect(
+ host='localhost', user='username', passwd='', db='db_webqtl') as mydb:
+ with mydb.cursor() as cursor:
-csv_data = csv.reader(file('GN711_pvalues.txt'), delimiter ="\t")
-for row in csv_data:
-
- cursor.execute("""UPDATE ProbeSetXRef SET pValue = %s WHERE ProbeSetFreezeId = %s AND ProbeSetId = %s """,
- (row))
-#close the connection to the database.
-mydb.commit()
-cursor.close()
-print("Done") \ No newline at end of file
+ csv_data = csv.reader(file('GN711_pvalues.txt'), delimiter ="\t")
+ for row in csv_data:
+ cursor.execute(
+ """UPDATE ProbeSetXRef SET pValue = %s WHERE ProbeSetFreezeId = %s AND ProbeSetId = %s """,
+ (row))
+print("Done")