Skip to content

Commit 09ca114

Browse files
committed
fix: db url
1 parent 1b17c68 commit 09ca114

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

backend/apps/datasource/crud/datasource.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
def get_datasource_list(session: SessionDep, user: CurrentUser):
2727
oid = user.oid if user.oid is not None else 1
2828
return session.query(CoreDatasource).filter(CoreDatasource.oid == oid).order_by(
29-
func.convert_to(CoreDatasource.name, 'gbk')).all()
29+
func.convert_to(CoreDatasource.name, 'gbk')).all()
3030

3131

3232
def get_ds(session: SessionDep, id: int):
@@ -42,6 +42,7 @@ def check_status(session: SessionDep, ds: CoreDatasource):
4242
print("success")
4343
return True
4444
except Exception as e:
45+
raise HTTPException(status_code=500, detail=e.args)
4546
print("Fail:", e)
4647
return False
4748

backend/apps/db/db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def get_engine(ds: CoreDatasource) -> Engine:
5858
conf.timeout = 30
5959
if ds.type == "pg" and (conf.dbSchema is not None and conf.dbSchema != ""):
6060
engine = create_engine(get_uri(ds),
61-
connect_args={"options": f"-c search_path={conf.dbSchema}",
61+
connect_args={"options": f"-c search_path={urllib.parse.quote(conf.dbSchema)}",
6262
"connect_timeout": conf.timeout},
6363
pool_timeout=conf.timeout, pool_size=20, max_overflow=10)
6464
elif ds.type == 'sqlServer':

0 commit comments

Comments
 (0)