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