aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorAlexander_Kabui2023-01-23 13:40:31 +0300
committerAlexander_Kabui2023-01-23 13:40:31 +0300
commitc728e6d2448d3f23c568e30a43ab8fdcc8785f96 (patch)
tree6152a44af5a7a5618e9b7a4e7b90f8b86134c1e8 /wqflask
parentc5ae72c8b8dffb5c8391b655a1bde21426fb92a0 (diff)
downloadgenenetwork2-c728e6d2448d3f23c568e30a43ab8fdcc8785f96.tar.gz
extract db connection
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/correlation/correlation_file_generator.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/wqflask/wqflask/correlation/correlation_file_generator.py b/wqflask/wqflask/correlation/correlation_file_generator.py
index 401b3ba6..e06c4123 100644
--- a/wqflask/wqflask/correlation/correlation_file_generator.py
+++ b/wqflask/wqflask/correlation/correlation_file_generator.py
@@ -2,6 +2,29 @@ from urllib.parse import urlparse
import pymysql as mdb
import os
import csv
+import lmdb
+import os
+import tempfile
+
+
+
+def parse_db_url():
+ """function to parse SQL_URI env variable note:there\
+ is a default value for SQL_URI so a tuple result is\
+ always expected"""
+ parsed_db = urlparse(SQL_URI)
+
+
+ return (
+ parsed_db.hostname, parsed_db.username, parsed_db.password,
+ parsed_db.path[1:], 3306)
+
+
+# This function is deprecated. Use database_connection instead.
+def database_connector():
+ """function to create db connector"""
+ host, user, passwd, db_name, db_port = parse_db_url()
+ return mdb.connect(host=host,user=user,password=passwd,database=db_name)
def get_probesetfreezes(conn, inbredsetid=1):
@@ -107,9 +130,6 @@ def generate_csv_file(conn,db_name,txt_dir,file_name):
# file name ,file expiry,type of storage
- # I want to use lmdb to store the files
- # file name already done #import that
-
# file expiry to be done lt
try: