Skip to content

Commit 1161be9

Browse files
perf: Embedded dynamic data source acquisition version
1 parent d518cbc commit 1161be9

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

backend/apps/db/db.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,19 @@ def check_connection(trans: Trans, ds: CoreDatasource, is_raise: bool = False):
155155
return False
156156

157157

158-
def get_version(ds: CoreDatasource):
159-
conf = DatasourceConf(**json.loads(aes_decrypt(ds.configuration))) if ds.type != "excel" else get_engine_config()
158+
def get_version(ds: CoreDatasource | AssistantOutDsSchema):
159+
conf = None
160+
if isinstance(ds, CoreDatasource):
161+
conf = DatasourceConf(**json.loads(aes_decrypt(ds.configuration))) if ds.type != "excel" else get_engine_config()
162+
if isinstance(ds, AssistantOutDsSchema):
163+
conf = DatasourceConf()
164+
conf.host = ds.host
165+
conf.port = ds.port
166+
conf.username = ds.user
167+
conf.password = ds.password
168+
conf.database = ds.dataBase
169+
conf.dbSchema = ds.db_schema
170+
conf.timeout = 10
160171
db = DB.get_db(ds.type)
161172
sql = get_version_sql(ds, conf)
162173
try:

0 commit comments

Comments
 (0)