diff options
Diffstat (limited to 'qc_app')
-rw-r--r-- | qc_app/db_utils.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/qc_app/db_utils.py b/qc_app/db_utils.py index 239f45c..98f8332 100644 --- a/qc_app/db_utils.py +++ b/qc_app/db_utils.py @@ -11,10 +11,11 @@ def parse_db_url(db_url) -> Tuple: """ parsed_db = urlparse(db_url) return (parsed_db.hostname, parsed_db.username, - parsed_db.password, parsed_db.path[1:]) + parsed_db.password, parsed_db.path[1:], parsed_db.port) def database_connection(db_url: Optional[str] = None) -> mdb.Connection: """function to create db connector""" - host, user, passwd, db_name = parse_db_url(db_url or app.config["SQL_URI"]) - return mdb.connect(host, user, passwd, db_name) + host, user, passwd, db_name, db_port = parse_db_url( + db_url or app.config["SQL_URI"]) + return mdb.connect(host, user, passwd, db_name, port=(db_port or 3306)) |