Skip to content

Commit 9b7c12f

Browse files
committed
feat(datasource): engine config
1 parent a311ac6 commit 9b7c12f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

backend/apps/db/engine.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Author: Junjun
22
# Date: 2025/5/19
3+
import urllib.parse
34
from typing import List
45

56
from sqlalchemy import create_engine, text, MetaData, Table
@@ -16,7 +17,7 @@ def get_engine_config():
1617

1718

1819
def get_engine_uri(conf: DatasourceConf):
19-
return f"postgresql+psycopg2://{conf.username}:{conf.password}@{conf.host}:{conf.port}/{conf.database}"
20+
return f"postgresql+psycopg2://{urllib.parse.quote(conf.username)}:{urllib.parse.quote(conf.password)}@{conf.host}:{conf.port}/{urllib.parse.quote(conf.database)}"
2021

2122

2223
def get_engine_conn():

0 commit comments

Comments
 (0)