forked from github/dataease
Merge pull request #9740 from dataease/pr@dev-v2@sysvariable
fix(数据源): 展示表备注信息
This commit is contained in:
commit
796768fd6e
@ -117,7 +117,7 @@ public class CalciteProvider {
|
||||
tableDesc.setDatasourceId(datasourceRequest.getDatasource().getId());
|
||||
tableDesc.setType("db");
|
||||
tableDesc.setTableName(resultSet.getString(1));
|
||||
tableDesc.setName(resultSet.getString(1));
|
||||
tableDesc.setName(resultSet.getString(2));
|
||||
return tableDesc;
|
||||
}
|
||||
|
||||
@ -315,6 +315,7 @@ public class CalciteProvider {
|
||||
private String getTableFiledSql(DatasourceRequest datasourceRequest) {
|
||||
String sql = "";
|
||||
DatasourceConfiguration configuration = null;
|
||||
String database="";
|
||||
DatasourceType datasourceType = DatasourceType.valueOf(datasourceRequest.getDatasource().getType());
|
||||
switch (datasourceType) {
|
||||
case mysql:
|
||||
@ -324,7 +325,16 @@ public class CalciteProvider {
|
||||
case StarRocks:
|
||||
case doris:
|
||||
configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Mysql.class);
|
||||
sql = String.format("SELECT COLUMN_NAME,DATA_TYPE,COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'", configuration.getDataBase(), datasourceRequest.getTable());
|
||||
if (configuration.getUrlType().equalsIgnoreCase("")) {
|
||||
database = configuration.getDataBase();
|
||||
} else {
|
||||
Pattern WITH_SQL_FRAGMENT = Pattern.compile("jdbc:mysql://(.*):(\\d+)/(.*)");
|
||||
Matcher matcher = WITH_SQL_FRAGMENT.matcher(configuration.getJdbcUrl());
|
||||
matcher.find();
|
||||
String[] databasePrams = matcher.group(3).split("\\?");
|
||||
database = databasePrams[0];
|
||||
}
|
||||
sql = String.format("SELECT COLUMN_NAME,DATA_TYPE,COLUMN_COMMENT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'", database, datasourceRequest.getTable());
|
||||
break;
|
||||
case oracle:
|
||||
configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Oracle.class);
|
||||
@ -396,6 +406,16 @@ public class CalciteProvider {
|
||||
break;
|
||||
case ck:
|
||||
configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), CK.class);
|
||||
|
||||
if (configuration.getUrlType().equalsIgnoreCase("")) {
|
||||
database = configuration.getDataBase();
|
||||
} else {
|
||||
Pattern WITH_SQL_FRAGMENT = Pattern.compile("jdbc:clickhouse://(.*):(\\d+)/(.*)");
|
||||
Matcher matcher = WITH_SQL_FRAGMENT.matcher(configuration.getJdbcUrl());
|
||||
matcher.find();
|
||||
String[] databasePrams = matcher.group(3).split("\\?");
|
||||
database = databasePrams[0];
|
||||
}
|
||||
sql = String.format(" SELECT\n" +
|
||||
" name,\n" +
|
||||
" type,\n" +
|
||||
@ -404,7 +424,7 @@ public class CalciteProvider {
|
||||
" system.columns\n" +
|
||||
"WHERE\n" +
|
||||
" database = '%s' \n" +
|
||||
" AND table = '%s' ", configuration.getDataBase(), datasourceRequest.getTable());
|
||||
" AND table = '%s' ", database, datasourceRequest.getTable());
|
||||
break;
|
||||
case impala:
|
||||
sql = String.format("DESCRIBE `%s`", datasourceRequest.getTable());
|
||||
|
@ -249,7 +249,7 @@ export default {
|
||||
remark: '备注',
|
||||
column_name: '字段名',
|
||||
field_type: '字段类型',
|
||||
field_description: '字段描述',
|
||||
field_description: '字段备注',
|
||||
dl: '数据湖',
|
||||
other: '其他',
|
||||
local_file: '本地文件',
|
||||
@ -393,7 +393,7 @@ export default {
|
||||
no_data_table: '暂无数据表',
|
||||
on_the_left: '请在左侧选择数据源',
|
||||
create_dataset: '创建数据集',
|
||||
table_description: '表描述',
|
||||
table_description: '表备注',
|
||||
relational_database: '关系型数据库',
|
||||
data_warehouse_lake: '数仓/数据湖',
|
||||
non_relational_database: '非关系型数据库',
|
||||
|
@ -91,7 +91,7 @@ const { width, node } = useMoveLine('DATASOURCE')
|
||||
|
||||
const dsTableDetail = reactive({
|
||||
tableName: '',
|
||||
remark: ''
|
||||
name: ''
|
||||
})
|
||||
const rootManage = ref(false)
|
||||
const nickName = ref('')
|
||||
@ -1356,7 +1356,7 @@ const getMenuList = (val: boolean) => {
|
||||
{{ t('datasource.table_description') }}
|
||||
</p>
|
||||
<p class="table-value">
|
||||
{{ dsTableDetail.remark || '-' }}
|
||||
{{ dsTableDetail.name || '-' }}
|
||||
</p>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
Loading…
Reference in New Issue
Block a user