diff options
author | Frederick Muriuki Muriithi | 2022-08-31 03:30:01 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-08-31 03:30:01 +0300 |
commit | 97f0b71f5a2e8ed7d862f4ca43ea33b2000cd5b6 (patch) | |
tree | 0ce70f4dd083c8d7f07dd6a1fb722e8a8e631ac6 /qc_app | |
parent | 215f4e07ccb7cef5db2c50d322a28576e2b9fd68 (diff) | |
download | gn-uploader-97f0b71f5a2e8ed7d862f4ca43ea33b2000cd5b6.tar.gz |
Provide database port where relevant.
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)) |