跳到主要内容

列名列表

接口描述

获取表的列,以便创建任务时选取需要的列

接口地址

/cloudcanal/console/api/v1/openapi/datasource/listcols

请求方式

POST

请求参数

参数名称参数说明请求类型是否必须数据类型
clusterId尝试连接数据源的机器集群idbodyLong
dataSourceId目标数据源idbodyLong
hostType所选数据源网络类型

PRIVATE(内网)
PUBLIC(公网)
bodyString
schemas是一个符合结构数组,具体说明如下bodyString

schema 复合结构说明

参数名称参数说明请求类型是否必须数据类型
dbdatabase 名称,关系型数据库不为空bodyString
schemaschema 名称,MySQL 为空bodyString
tables表名列表bodyString

schema 复合结构示例

{
"schemas": [
{
"db": "",
"schema": "",
"tables": []
}
]
}

公共响应结果

参数名称参数说明类型(java)不为空
code1:成功 0:失败string
dataobject
msgstring
requestIdstring

data 参数说明

参数名称参数说明类型(java)不为空
tableMetaDataMap包含多个库,多个表 中的列信息String
noPkTableNameList没有主键的表列表String
numberOfShardskudu 数据源有效String
numberOfReplicaskudu 数据源有效String

列信息说明

参数名称参数说明类型(java)不为空
columnName列名称String
dataTypeWithLength带长度描述的数据类型String
isNullable是否可为nullBoolean
dataType数据类型String
sqlTypeIntValue类型长度int
jdbcTypejdbc类型String
timePrecision时间精度int
characterMaxLength字符串长度String
numberPrecision数字精度int
numberScale数字scaleint
esAnalyzerTypeElasticSearch 分词器类型String
needIndexElasticSearch field是否需要索引String
timeFormat时间格式String
pk是否是主键Boolean

响应示例

{
"requestId": "6fd787d4-2bdf-11ec-b616-5141902f97d8",
"code": "1",
"msg": "request success",
"data": {
"tableMetaDataMap": {
"console": {
"worker_stats": [
{
"columnName": "id",
"dataTypeWithLength": null,
"isNullable": "yes",
"dataType": "BIGINT",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": null,
"numberPrecision": 19,
"numberScale": 0,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": true
},
{
"columnName": "gmt_create",
"dataTypeWithLength": null,
"isNullable": "yes",
"dataType": "DATETIME",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": 0,
"characterMaxLength": null,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
},
{
"columnName": "worker_id",
"dataTypeWithLength": null,
"isNullable": "yes",
"dataType": "BIGINT",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": null,
"numberPrecision": 19,
"numberScale": 0,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
},
{
"columnName": "cpu_stat",
"dataTypeWithLength": null,
"isNullable": "no",
"dataType": "TEXT",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": 65535,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
},
{
"columnName": "mem_stat",
"dataTypeWithLength": null,
"isNullable": "no",
"dataType": "TEXT",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": 65535,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
},
{
"columnName": "disk_stat",
"dataTypeWithLength": null,
"isNullable": "no",
"dataType": "TEXT",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": 65535,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
}
],
"cluster": [
{
"columnName": "id",
"dataTypeWithLength": null,
"isNullable": "yes",
"dataType": "BIGINT",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": null,
"numberPrecision": 19,
"numberScale": 0,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": true
},
{
"columnName": "gmt_create",
"dataTypeWithLength": null,
"isNullable": "yes",
"dataType": "DATETIME",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": 0,
"characterMaxLength": null,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
},
{
"columnName": "gmt_modified",
"dataTypeWithLength": null,
"isNullable": "yes",
"dataType": "DATETIME",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": 0,
"characterMaxLength": null,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
},
{
"columnName": "cluster_name",
"dataTypeWithLength": null,
"isNullable": "yes",
"dataType": "VARCHAR",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": 128,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
},
{
"columnName": "region",
"dataTypeWithLength": null,
"isNullable": "no",
"dataType": "VARCHAR",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": 64,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
},
{
"columnName": "cloud_or_idc_name",
"dataTypeWithLength": null,
"isNullable": "no",
"dataType": "VARCHAR",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": 128,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
},
{
"columnName": "console_host",
"dataTypeWithLength": null,
"isNullable": "no",
"dataType": "VARCHAR",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": 255,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
},
{
"columnName": "zk_host",
"dataTypeWithLength": null,
"isNullable": "no",
"dataType": "VARCHAR",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": 255,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
},
{
"columnName": "cluster_desc",
"dataTypeWithLength": null,
"isNullable": "yes",
"dataType": "VARCHAR",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": 128,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
},
{
"columnName": "uid",
"dataTypeWithLength": null,
"isNullable": "no",
"dataType": "VARCHAR",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": 255,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
}
]
},
"dingtax": {
"kbs_new_create": [
{
"columnName": "id",
"dataTypeWithLength": null,
"isNullable": "yes",
"dataType": "BIGINT",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": null,
"numberPrecision": 19,
"numberScale": 0,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": true
},
{
"columnName": "name",
"dataTypeWithLength": null,
"isNullable": "no",
"dataType": "VARCHAR",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": null,
"characterMaxLength": 244,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
},
{
"columnName": "new_col",
"dataTypeWithLength": null,
"isNullable": "no",
"dataType": "DATETIME",
"sqlTypeIntValue": 0,
"jdbcType": null,
"timePrecision": 0,
"characterMaxLength": null,
"numberPrecision": null,
"numberScale": null,
"esAnalyzerType": null,
"needIndex": null,
"timeFormat": null,
"pk": false
}
]
}
},
"noPkTableNameList": {},
"numberOfShards": null,
"numberOfReplicas": null
}
}