Metadata Query API

The new interface after the optimization of the metadata query interface, see Metadata Query API for the old interface that has been abandoned. Compared with the old interface, mainly adjust the request path and interface parameter naming

MetadataQueryRestful class

Interface address:/api/rest_j/v1//metadataQuery/getColumns

Request method: GET

Request data type: application/x-www-form-urlencoded

Response data type: application/json

Interface description: Get the column information of the data table

Request Parameters:

Parameter nameParameter descriptionRequest typeRequiredData typeschema
dataSourceNamedataSourceNamepathtruestring
databasedatabasepathtruestring
systemsystemquerytruestring
tabletablepathtruestring

Sample Response:

  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. }

Interface address:/api/rest_j/v1//metadataQuery/getDatabases

Request method: GET

Request data type: application/x-www-form-urlencoded

Response data type: application/json

Interface description: Get the list of database names of the data source

Request Parameters:

Parameter nameParameter descriptionRequest typeRequiredData typeschema
dataSourceNamedataSourceNamepathtruestring
systemsystemquerytruestring

Sample Response:

  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. }

return value adjusted to props -> partitions

Interface address:/api/rest_j/v1//metadataQuery/getPartitions

Request method: GET

Request data type: application/x-www-form-urlencoded

Response data type: application/json

Interface description:

Request Parameters:

Parameter nameParameter descriptionRequest typeRequiredData typeschema
dataSourceNamedataSourceNamepathtruestring
databasedatabasepathtruestring
systemsystemquerytruestring
tabletablepathtruestring
traversetraversequeryfalseboolean

Sample Response:

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

Interface address:/api/rest_j/v1//metadataQuery/getTableProps

Request method: GET

Request data type: application/x-www-form-urlencoded

Response data type: application/json

Interface description:

Request Parameters:

Parameter nameParameter descriptionRequest typeRequiredData typeschema
dataSourceNamedataSourceNamepathtruestring
databasedatabasepathtruestring
systemsystemquerytruestring
tabletablepathtruestring

Sample Response:

  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: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. }

Interface address:/api/rest_j/v1//metadataQuery/getPartitionProps

Request method: GET

Request data type: application/x-www-form-urlencoded

Response data type: application/json

Interface description:

Request Parameters:

Parameter nameParameter descriptionRequest typeRequiredData typeschema
dataSourceNamedataSourceNamepathtruestring
databasedatabasepathtruestring
partitionpartitionpathtruestring
systemsystemquerytruestring
tabletablepathtruestring

Sample Response:

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

Interface address:/api/rest_j/v1//metadataQuery/getTables

Request method: GET

Request data type: application/x-www-form-urlencoded

Response data type: application/json

Interface description: Get the list of data tables of a database of the data source

Request Parameters:

Parameter nameParameter descriptionRequest typeRequiredData typeschema
dataSourceNamedataSourceNamepathtruestring
databasedatabasepathtruestring
systemsystemquerytruestring

Sample Response:

  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. }