Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion backend/apps/datasource/models/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class DatasourceConf(BaseModel):
sheets: List = ''
mode: str = ''
timeout: int = 30
lowVersion: bool = False

def to_dict(self):
return {
Expand All @@ -134,7 +135,8 @@ def to_dict(self):
"filename": self.filename,
"sheets": self.sheets,
"mode": self.mode,
"timeout": self.timeout
"timeout": self.timeout,
"lowVersion": self.lowVersion
}


Expand Down
32 changes: 22 additions & 10 deletions backend/apps/db/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,28 @@ def get_extra_config(conf: DatasourceConf):
def get_origin_connect(type: str, conf: DatasourceConf):
extra_config_dict = get_extra_config(conf)
if equals_ignore_case(type, "sqlServer"):
return pymssql.connect(
server=conf.host,
port=str(conf.port),
user=conf.username,
password=conf.password,
database=conf.database,
timeout=conf.timeout,
tds_version='7.0', # options: '4.2', '7.0', '8.0' ...,
**extra_config_dict
)
# none or true, set tds_version = 7.0
if conf.lowVersion is None or conf.lowVersion:
return pymssql.connect(
server=conf.host,
port=str(conf.port),
user=conf.username,
password=conf.password,
database=conf.database,
timeout=conf.timeout,
tds_version='7.0', # options: '4.2', '7.0', '8.0' ...,
**extra_config_dict
)
else:
return pymssql.connect(
server=conf.host,
port=str(conf.port),
user=conf.username,
password=conf.password,
database=conf.database,
timeout=conf.timeout,
**extra_config_dict
)


# use sqlalchemy
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@
"failed": "Connect failed"
},
"timeout": "Timeout(second)",
"address": "Address"
"address": "Address",
"low_version": "Compatible with lower versions"
},
"sync_fields": "Sync Fields"
},
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/i18n/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@
"failed": "연결 실패"
},
"timeout": "쿼리 시간 초과(초)",
"address": "주소"
"address": "주소",
"low_version": "낮은 버전 호환"
},
"sync_fields": "동기화된 테이블 구조"
},
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@
"failed": "连接失败"
},
"timeout": "查询超时(秒)",
"address": "地址"
"address": "地址",
"low_version": "兼容低版本"
},
"sync_fields": "同步表结构"
},
Expand Down
15 changes: 15 additions & 0 deletions frontend/src/views/ds/DatasourceForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const form = ref<any>({
sheets: [],
mode: 'service_name',
timeout: 30,
lowVersion: false,
})

const close = () => {
Expand Down Expand Up @@ -159,6 +160,10 @@ const initForm = (item: any, editTable: boolean = false) => {
form.value.sheets = configuration.sheets
form.value.mode = configuration.mode
form.value.timeout = configuration.timeout ? configuration.timeout : 30
form.value.lowVersion =
configuration.lowVersion !== null && configuration.lowVersion !== undefined
? configuration.lowVersion
: true
}

if (editTable) {
Expand Down Expand Up @@ -230,6 +235,7 @@ const initForm = (item: any, editTable: boolean = false) => {
sheets: [],
mode: 'service_name',
timeout: 30,
lowVersion: false,
}
}
dialogVisible.value = true
Expand Down Expand Up @@ -317,6 +323,7 @@ const buildConf = () => {
sheets: form.value.sheets,
mode: form.value.mode,
timeout: form.value.timeout,
lowVersion: form.value.lowVersion,
})
)
const obj = JSON.parse(JSON.stringify(form.value))
Expand All @@ -332,6 +339,7 @@ const buildConf = () => {
delete obj.sheets
delete obj.mode
delete obj.timeout
delete obj.lowVersion
return obj
}

Expand Down Expand Up @@ -671,6 +679,13 @@ defineExpose({
<el-radio value="sid">{{ t('ds.form.mode.sid') }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
v-if="form.type === 'sqlServer'"
:label="t('ds.form.low_version')"
prop="low_version"
>
<el-checkbox v-model="form.lowVersion" :label="t('ds.form.low_version')" />
</el-form-item>
<el-form-item v-if="form.type !== 'es'" :label="t('ds.form.extra_jdbc')">
<el-input
v-model="form.extraJdbc"
Expand Down