mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
fix: db url
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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':
|
||||
|
||||
Reference in New Issue
Block a user