diff options
Diffstat (limited to 'wqflask/maintenance/set_resource_defaults.py')
-rw-r--r-- | wqflask/maintenance/set_resource_defaults.py | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/wqflask/maintenance/set_resource_defaults.py b/wqflask/maintenance/set_resource_defaults.py index 0d9372ff..cebe33c0 100644 --- a/wqflask/maintenance/set_resource_defaults.py +++ b/wqflask/maintenance/set_resource_defaults.py @@ -26,7 +26,7 @@ sys.path.insert(0, './') from wqflask import app from utility import hmac -from utility.tools import SQL_URI +from utility.tools import get_setting from utility.redis_tools import get_redis_conn, get_user_id, add_resource, get_resources, get_resource_info Redis = get_redis_conn() @@ -35,21 +35,6 @@ import urllib.parse from wqflask.database import database_connection -def parse_db_uri(): - """Converts a database URI to the db name, host name, user name, and password""" - - parsed_uri = urllib.parse.urlparse(SQL_URI) - - db_conn_info = dict( - db=parsed_uri.path[1:], - host=parsed_uri.hostname, - user=parsed_uri.username, - passwd=parsed_uri.password) - - print(db_conn_info) - return db_conn_info - - def insert_probeset_resources(cursor, default_owner_id): current_resources = Redis.hgetall("resources") cursor.execute(""" SELECT @@ -163,6 +148,6 @@ def main(cursor): if __name__ == '__main__': - with database_connection() as conn: + with database_connection(get_setting("SQL_URI")) as conn: with conn.cursor() as cursor: main(cursor) |