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.setDatasourceId(datasourceRequest.getDatasource().getId());
|
||||||
tableDesc.setType("db");
|
tableDesc.setType("db");
|
||||||
tableDesc.setTableName(resultSet.getString(1));
|
tableDesc.setTableName(resultSet.getString(1));
|
||||||
tableDesc.setName(resultSet.getString(1));
|
tableDesc.setName(resultSet.getString(2));
|
||||||
return tableDesc;
|
return tableDesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,6 +315,7 @@ public class CalciteProvider {
|
|||||||
private String getTableFiledSql(DatasourceRequest datasourceRequest) {
|
private String getTableFiledSql(DatasourceRequest datasourceRequest) {
|
||||||
String sql = "";
|
String sql = "";
|
||||||
DatasourceConfiguration configuration = null;
|
DatasourceConfiguration configuration = null;
|
||||||
|
String database="";
|
||||||
DatasourceType datasourceType = DatasourceType.valueOf(datasourceRequest.getDatasource().getType());
|
DatasourceType datasourceType = DatasourceType.valueOf(datasourceRequest.getDatasource().getType());
|
||||||
switch (datasourceType) {
|
switch (datasourceType) {
|
||||||
case mysql:
|
case mysql:
|
||||||
@ -324,7 +325,16 @@ public class CalciteProvider {
|
|||||||
case StarRocks:
|
case StarRocks:
|
||||||
case doris:
|
case doris:
|
||||||
configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Mysql.class);
|
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;
|
break;
|
||||||
case oracle:
|
case oracle:
|
||||||
configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Oracle.class);
|
configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), Oracle.class);
|
||||||
@ -396,6 +406,16 @@ public class CalciteProvider {
|
|||||||
break;
|
break;
|
||||||
case ck:
|
case ck:
|
||||||
configuration = JsonUtil.parseObject(datasourceRequest.getDatasource().getConfiguration(), CK.class);
|
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" +
|
sql = String.format(" SELECT\n" +
|
||||||
" name,\n" +
|
" name,\n" +
|
||||||
" type,\n" +
|
" type,\n" +
|
||||||
@ -404,7 +424,7 @@ public class CalciteProvider {
|
|||||||
" system.columns\n" +
|
" system.columns\n" +
|
||||||
"WHERE\n" +
|
"WHERE\n" +
|
||||||
" database = '%s' \n" +
|
" database = '%s' \n" +
|
||||||
" AND table = '%s' ", configuration.getDataBase(), datasourceRequest.getTable());
|
" AND table = '%s' ", database, datasourceRequest.getTable());
|
||||||
break;
|
break;
|
||||||
case impala:
|
case impala:
|
||||||
sql = String.format("DESCRIBE `%s`", datasourceRequest.getTable());
|
sql = String.format("DESCRIBE `%s`", datasourceRequest.getTable());
|
||||||
|
@ -249,7 +249,7 @@ export default {
|
|||||||
remark: '备注',
|
remark: '备注',
|
||||||
column_name: '字段名',
|
column_name: '字段名',
|
||||||
field_type: '字段类型',
|
field_type: '字段类型',
|
||||||
field_description: '字段描述',
|
field_description: '字段备注',
|
||||||
dl: '数据湖',
|
dl: '数据湖',
|
||||||
other: '其他',
|
other: '其他',
|
||||||
local_file: '本地文件',
|
local_file: '本地文件',
|
||||||
@ -393,7 +393,7 @@ export default {
|
|||||||
no_data_table: '暂无数据表',
|
no_data_table: '暂无数据表',
|
||||||
on_the_left: '请在左侧选择数据源',
|
on_the_left: '请在左侧选择数据源',
|
||||||
create_dataset: '创建数据集',
|
create_dataset: '创建数据集',
|
||||||
table_description: '表描述',
|
table_description: '表备注',
|
||||||
relational_database: '关系型数据库',
|
relational_database: '关系型数据库',
|
||||||
data_warehouse_lake: '数仓/数据湖',
|
data_warehouse_lake: '数仓/数据湖',
|
||||||
non_relational_database: '非关系型数据库',
|
non_relational_database: '非关系型数据库',
|
||||||
|
@ -91,7 +91,7 @@ const { width, node } = useMoveLine('DATASOURCE')
|
|||||||
|
|
||||||
const dsTableDetail = reactive({
|
const dsTableDetail = reactive({
|
||||||
tableName: '',
|
tableName: '',
|
||||||
remark: ''
|
name: ''
|
||||||
})
|
})
|
||||||
const rootManage = ref(false)
|
const rootManage = ref(false)
|
||||||
const nickName = ref('')
|
const nickName = ref('')
|
||||||
@ -1356,7 +1356,7 @@ const getMenuList = (val: boolean) => {
|
|||||||
{{ t('datasource.table_description') }}
|
{{ t('datasource.table_description') }}
|
||||||
</p>
|
</p>
|
||||||
<p class="table-value">
|
<p class="table-value">
|
||||||
{{ dsTableDetail.remark || '-' }}
|
{{ dsTableDetail.name || '-' }}
|
||||||
</p>
|
</p>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
Loading…
Reference in New Issue
Block a user