fix: db url

This commit is contained in:
junjun
2025-07-23 10:38:17 +08:00
parent 1b17c6853d
commit 09ca1149ec
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -26,7 +26,7 @@ from ..models.datasource import CoreDatasource, CreateDatasource, CoreTable, Cor
def get_datasource_list(session: SessionDep, user: CurrentUser):
oid = user.oid if user.oid is not None else 1
return session.query(CoreDatasource).filter(CoreDatasource.oid == oid).order_by(
func.convert_to(CoreDatasource.name, 'gbk')).all()
func.convert_to(CoreDatasource.name, 'gbk')).all()
def get_ds(session: SessionDep, id: int):
@@ -42,6 +42,7 @@ def check_status(session: SessionDep, ds: CoreDatasource):
print("success")
return True
except Exception as e:
raise HTTPException(status_code=500, detail=e.args)
print("Fail:", e)
return False
+1 -1
View File
@@ -58,7 +58,7 @@ def get_engine(ds: CoreDatasource) -> Engine:
conf.timeout = 30
if ds.type == "pg" and (conf.dbSchema is not None and conf.dbSchema != ""):
engine = create_engine(get_uri(ds),
connect_args={"options": f"-c search_path={conf.dbSchema}",
connect_args={"options": f"-c search_path={urllib.parse.quote(conf.dbSchema)}",
"connect_timeout": conf.timeout},
pool_timeout=conf.timeout, pool_size=20, max_overflow=10)
elif ds.type == 'sqlServer':