Skip to content

Commit ad16f62

Browse files
committed
fix: fix mysql check status error
1 parent a0ca17d commit ad16f62

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

backend/apps/db/db.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ def check_connection(trans: Trans, ds: CoreDatasource, is_raise: bool = False):
106106
conn = get_engine(ds, 10)
107107
try:
108108
with conn.connect() as connection:
109+
if ds.type == 'mysql':
110+
connection.execute(text('select 1')).fetchall()
109111
SQLBotLogUtil.info("success")
110112
return True
111113
except Exception as e:
@@ -158,7 +160,8 @@ def check_connection(trans: Trans, ds: CoreDatasource, is_raise: bool = False):
158160
def get_version(ds: CoreDatasource | AssistantOutDsSchema):
159161
conf = None
160162
if isinstance(ds, CoreDatasource):
161-
conf = DatasourceConf(**json.loads(aes_decrypt(ds.configuration))) if ds.type != "excel" else get_engine_config()
163+
conf = DatasourceConf(
164+
**json.loads(aes_decrypt(ds.configuration))) if ds.type != "excel" else get_engine_config()
162165
if isinstance(ds, AssistantOutDsSchema):
163166
conf = DatasourceConf()
164167
conf.host = ds.host

0 commit comments

Comments
 (0)