Skip to content

Commit 06491d8

Browse files
committed
fix: Compatible with older versions of MSSQL in DataEase
1 parent b1a425a commit 06491d8

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

backend/apps/system/crud/assistant.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def init_dynamic_cors(app: FastAPI):
9494
response_middleware = middleware
9595
if cors_middleware and response_middleware:
9696
break
97-
97+
9898
updated_origins = list(set(settings.all_cors_origins + unique_domains))
9999
if cors_middleware:
100100
cors_middleware.kwargs['allow_origins'] = updated_origins
@@ -238,19 +238,19 @@ def get_ds(self, ds_id: int, trans: Trans = None):
238238

239239
def convert2schema(self, ds_dict: dict, config: dict[any]) -> AssistantOutDsSchema:
240240
id_marker: str = ''
241-
attr_list = ['name', 'type', 'host', 'port', 'user', 'dataBase', 'schema', 'mode']
241+
attr_list = ['name', 'type', 'host', 'port', 'user', 'dataBase', 'schema', 'mode', 'lowVersion']
242242
if config.get('encrypt', False):
243243
key = config.get('aes_key', None)
244244
iv = config.get('aes_iv', None)
245-
aes_attrs = ['host', 'user', 'password', 'dataBase', 'db_schema', 'schema', 'mode']
245+
aes_attrs = ['host', 'user', 'password', 'dataBase', 'db_schema', 'schema', 'mode', 'lowVersion']
246246
for attr in aes_attrs:
247247
if attr in ds_dict and ds_dict[attr]:
248248
try:
249249
ds_dict[attr] = simple_aes_decrypt(ds_dict[attr], key, iv)
250250
except Exception as e:
251251
raise Exception(
252252
f"Failed to encrypt {attr} for datasource {ds_dict.get('name')}, error: {str(e)}")
253-
253+
254254
id = ds_dict.get('id', None)
255255
if not id:
256256
for attr in attr_list:
@@ -279,7 +279,8 @@ def get_out_ds_conf(ds: AssistantOutDsSchema, timeout: int = 30) -> str:
279279
"extraJdbc": ds.extraParams or '',
280280
"dbSchema": ds.db_schema or '',
281281
"timeout": timeout or 30,
282-
"mode": ds.mode or ''
282+
"mode": ds.mode or '',
283+
"lowVersion": ds.lowVersion or False,
283284
}
284285
conf["extraJdbc"] = ''
285286
return aes_encrypt(json.dumps(conf))

backend/apps/system/schemas/system_schema.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ class AssistantOutDsSchema(AssistantOutDsBase):
197197
db_schema: Optional[str] = None
198198
extraParams: Optional[str] = None
199199
mode: Optional[str] = None
200+
lowVersion: Optional[bool] = False
200201
tables: Optional[list[AssistantTableSchema]] = None
201202

202203

0 commit comments

Comments
 (0)