feat: connect

This commit is contained in:
junjun
2025-07-29 12:00:03 +08:00
parent 8141700746
commit f6253cdb0c
3 changed files with 9 additions and 23 deletions
+4 -10
View File
@@ -60,20 +60,14 @@ def get_engine(ds: CoreDatasource, timeout: int = 30) -> Engine:
engine = create_engine(get_uri(ds),
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)
pool_timeout=conf.timeout)
elif ds.type == 'sqlServer':
engine = create_engine(get_uri(ds), pool_timeout=conf.timeout,
pool_size=20,
max_overflow=10)
engine = create_engine(get_uri(ds), pool_timeout=conf.timeout)
elif ds.type == 'oracle':
engine = create_engine(get_uri(ds),
pool_timeout=conf.timeout,
pool_size=20,
max_overflow=10)
pool_timeout=conf.timeout)
else:
engine = create_engine(get_uri(ds), connect_args={"connect_timeout": conf.timeout}, pool_timeout=conf.timeout,
pool_size=20,
max_overflow=10)
engine = create_engine(get_uri(ds), connect_args={"connect_timeout": conf.timeout}, pool_timeout=conf.timeout)
return engine
+1 -3
View File
@@ -25,9 +25,7 @@ def get_engine_conn():
db_url = get_engine_uri(conf)
engine = create_engine(db_url,
connect_args={"options": f"-c search_path={conf.dbSchema}", "connect_timeout": conf.timeout},
pool_timeout=conf.timeout,
pool_size=20,
max_overflow=10)
pool_timeout=conf.timeout)
return engine
+4 -10
View File
@@ -213,18 +213,12 @@ def get_ds_engine(ds: AssistantOutDsSchema) -> Engine:
engine = create_engine(uri,
connect_args={"options": f"-c search_path={urllib.parse.quote(ds.db_schema)}",
"connect_timeout": timeout},
pool_timeout=timeout, pool_size=20, max_overflow=10)
pool_timeout=timeout)
elif ds.type == 'sqlServer':
engine = create_engine(uri, pool_timeout=timeout,
pool_size=20,
max_overflow=10)
engine = create_engine(uri, pool_timeout=timeout)
elif ds.type == 'oracle':
engine = create_engine(uri,
pool_timeout=timeout,
pool_size=20,
max_overflow=10)
pool_timeout=timeout)
else:
engine = create_engine(uri, connect_args={"connect_timeout": timeout}, pool_timeout=timeout,
pool_size=20,
max_overflow=10)
engine = create_engine(uri, connect_args={"connect_timeout": timeout}, pool_timeout=timeout)
return engine