元数据查询API(新)

元数据查询接口优化之后的新接口,已废弃的旧接口见元数据查询API,相对于旧接口,主要调整请求的路径和接口参数命名

MetadataQueryRestful 类

getColumns

接口地址:/api/rest_j/v1//metadataQuery/getColumns

请求方式:GET

请求数据类型:application/x-www-form-urlencoded

响应数据类型:application/json

接口描述: 获取数据表的column信息

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
dataSourceNamedataSourceNamepathtruestring
databasedatabasepathtruestring
systemsystemquerytruestring
tabletablepathtruestring

响应示例:

  1. {
  2. "method": null,
  3. "status": 0,
  4. "message": "OK",
  5. "data": {
  6. "columns": [
  7. {
  8. "index": 1,
  9. "primaryKey": true,
  10. "name": "id",
  11. "type": "INT"
  12. },
  13. {
  14. "index": 2,
  15. "primaryKey": false,
  16. "name": "datasource_name",
  17. "type": "VARCHAR"
  18. },
  19. {
  20. "index": 3,
  21. "primaryKey": false,
  22. "name": "datasource_desc",
  23. "type": "VARCHAR"
  24. },
  25. ]
  26. }
  27. }

getDatabases

接口地址:/api/rest_j/v1//metadataQuery/getDatabases

请求方式:GET

请求数据类型:application/x-www-form-urlencoded

响应数据类型:application/json

接口描述:获取数据源的数据库名称列表

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
dataSourceNamedataSourceNamepathtruestring
systemsystemquerytruestring

响应示例:

  1. {
  2. "method": null,
  3. "status": 0,
  4. "message": "OK",
  5. "data": {
  6. "dbs": [
  7. "information_schema",
  8. "linkis",
  9. "linkis_sit"
  10. ]
  11. }
  12. }

getPartitions

返回值调整为 props -> partitions

接口地址:/api/rest_j/v1//metadataQuery/getPartitions

请求方式:GET

请求数据类型:application/x-www-form-urlencoded

响应数据类型:application/json

接口描述:

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
dataSourceNamedataSourceNamepathtruestring
databasedatabasepathtruestring
systemsystemquerytruestring
tabletablepathtruestring
traversetraversequeryfalseboolean

响应示例:

  1. {
  2. "method": null,
  3. "status": 0,
  4. "message": "OK",
  5. "data": {
  6. "partitions": {
  7. "partKeys": [
  8. "ds"
  9. ],
  10. "root": {}
  11. }
  12. }
  13. }

getTableProps

接口地址:/api/rest_j/v1//metadataQuery/getTableProps

请求方式:GET

请求数据类型:application/x-www-form-urlencoded

响应数据类型:application/json

接口描述:

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
dataSourceNamedataSourceNamepathtruestring
databasedatabasepathtruestring
systemsystemquerytruestring
tabletablepathtruestring

响应示例:

  1. {
  2. "method": null,
  3. "status": 0,
  4. "message": "OK",
  5. "data": {
  6. "props": {
  7. "skip.header.line.count": "1",
  8. "columns.types": "int:int:string:string:string:string:string:string:string:string:string:string:string:string:string:string:string:string",
  9. "columns": "id,age,job,marital,education,default,balance,housing,loan,contact,day,month,duration,campaign,pdays,previous,poutcome,y",
  10. "field.delim": ",",
  11. "transient_lastDdlTime": "1646732554",
  12. "partition_columns.types": "string",
  13. "columns.comments": "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000",
  14. "bucket_count": "-1",
  15. "serialization.ddl": "struct demo_data { i32 id, i32 age, string job, string marital, string education, string default, string balance, string housing, string loan, string contact, string day, string month, string duration, string campaign, string pdays, string previous, string poutcome, string y}",
  16. "file.outputformat": "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat",
  17. "partition_columns": "ds",
  18. "colelction.delim": "-",
  19. "serialization.lib": "org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe",
  20. "name": "dss_autotest.demo_data",
  21. "location": "hdfs://bdpdev01/user/hive/warehouse/hadoop/dss_autotest.db/demo_data",
  22. "mapkey.delim": ":",
  23. "file.inputformat": "org.apache.hadoop.mapred.TextInputFormat",
  24. "serialization.format": ",",
  25. "column.name.delimiter": ","
  26. }
  27. }
  28. }

getPartitionProps

接口地址:/api/rest_j/v1//metadataQuery/getPartitionProps

请求方式:GET

请求数据类型:application/x-www-form-urlencoded

响应数据类型:application/json

接口描述:

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
dataSourceNamedataSourceNamepathtruestring
databasedatabasepathtruestring
partitionpartitionpathtruestring
systemsystemquerytruestring
tabletablepathtruestring

响应示例:

  1. {
  2. "data": {},
  3. "message": "",
  4. "method": "",
  5. "status": 0
  6. }

getTables

接口地址:/api/rest_j/v1//metadataQuery/getTables

请求方式:GET

请求数据类型:application/x-www-form-urlencoded

响应数据类型:application/json

接口描述: 获取数据源的某个数据库的数据表列表

请求参数:

参数名称参数说明请求类型是否必须数据类型schema
dataSourceNamedataSourceNamepathtruestring
databasedatabasepathtruestring
systemsystemquerytruestring

响应示例:

  1. {
  2. "method": null,
  3. "status": 0,
  4. "message": "OK",
  5. "data": {
  6. "tables": [
  7. "test",
  8. "test_0317a",
  9. "test_import_sqoop_1",
  10. "test_linkis_sqoop_1",
  11. "test_linkis_sqoop_2",
  12. "test_linkis_sqoop_3",
  13. "upload_test"
  14. ]
  15. }
  16. }