aboutsummaryrefslogtreecommitdiff
path: root/wqflask/wqflask/do_search.py
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/wqflask/do_search.py')
-rw-r--r--wqflask/wqflask/do_search.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/wqflask/wqflask/do_search.py b/wqflask/wqflask/do_search.py
index 2cc6aa61..1e245d6a 100644
--- a/wqflask/wqflask/do_search.py
+++ b/wqflask/wqflask/do_search.py
@@ -989,8 +989,6 @@ def get_aliases(symbol, species):
if __name__ == "__main__":
# Usually this will be used as a library, but call it from the command line for testing
# And it runs the code below
-
- import MySQLdb
import sys
from base import webqtlConfig
@@ -998,15 +996,11 @@ if __name__ == "__main__":
from utility import webqtlUtil
from db import webqtlDatabaseFunction
- db_conn = MySQLdb.Connect(db=webqtlConfig.DB_NAME,
- host=webqtlConfig.MYSQL_SERVER,
- user=webqtlConfig.DB_USER,
- passwd=webqtlConfig.DB_PASSWD)
- cursor = db_conn.cursor()
-
- dataset_name = "HC_M2_0606_P"
- dataset = create_dataset(db_conn, dataset_name)
+ from wqflask.database import database_connection
- results = PvalueSearch(['0.005'], '<', dataset, cursor, db_conn).run()
+ with database_connection() as db_conn:
+ with db_conn.cursor() as cursor:
+ dataset_name = "HC_M2_0606_P"
+ dataset = create_dataset(db_conn, dataset_name)
- db_conn.close()
+ results = PvalueSearch(['0.005'], '<', dataset, cursor, db_conn).run()