feat: connect

This commit is contained in:
junjun
2025-07-29 12:14:39 +08:00
parent f6253cdb0c
commit 91cd477e35
+3 -1
View File
@@ -52,10 +52,12 @@ def get_uri_from_config(type: str, conf: DatasourceConf) -> str:
return db_url
def get_engine(ds: CoreDatasource, timeout: int = 30) -> Engine:
def get_engine(ds: CoreDatasource, timeout: int = 0) -> Engine:
conf = DatasourceConf(**json.loads(aes_decrypt(ds.configuration))) if ds.type != "excel" else get_engine_config()
if conf.timeout is None:
conf.timeout = timeout
if timeout > 0:
conf.timeout = timeout
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={urllib.parse.quote(conf.dbSchema)}",