All Products
Search
Document Center

DataWorks:GetDataSourceMeta

Last Updated:Nov 21, 2024

Queries the metadata of a specified data source.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
dataworks:*get
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ProjectIdlongYes

The DataWorks workspace ID. You can log on to the DataWorks console and go to the Workspace page to obtain the ID.

10000
DatasourceNamestringYes

The name of the data source.

mysql_name
PageNumberlongYes

The page number.

1
PageSizelongYes

The number of entries per page.

10
EnvTypestringNo

The environment in which the data source resides. Valid values:

  • 0: development environment
  • 1: production environment
1

Response parameters

ParameterTypeDescriptionExample
object

The returned result.

Successboolean

Indicates whether the request was successful. Valid values:

  • true
  • false
true
RequestIdstring

The request ID. You can locate logs and troubleshoot issues based on the ID.

0000-ABCD-EFG
Dataobject

The returned result.

Statusstring

Indicates whether the metadata of the data source is obtained. Valid values:

  • success: The metadata of the data source is obtained.
  • fail: The metadata of the data source failed to be obtained. You can troubleshoot issues based on the Message parameter.
success
Messagestring

The reason why the metadata of the data source fails to be obtained. If the metadata of the data source is obtained, no value is returned for this parameter.

read datasource time out
Metastring

The returned metadata of the data source. The returned metadata is in the JSON format.

{"dbTables":[{"dbName":"testdb","schema":[{"tableInfos":[{"dbName":"testdb","enable":true,"table":"table1","tableName":"table1"}]},{"tableInfos":[{"dbName":"testdb","enable":true,"table":"table2","tableName":"table2"}]}]}]}

Parameter description:

  • dbName: the name of the database in which the data source resides.
  • schema: the schema of the database.
  • enable: indicates whether the database is available. The valid values are true and false. The value true indicates that the database is available. The value false indicates that the database is unavailable.
  • tableName: the name of the table in the database.
  • tableInfos: the information about the table in the database.
{"dbTables":[{"dbName":"testdb","schema":[{"tableInfos":[{"dbName":"testdb","enable":true,"table":"table1","tableName":"table1"}]},{"tableInfos":[{"dbName":"testdb","enable":true,"table":"table2","tableName":"table2"}]}]}]}

Examples

Sample success responses

JSONformat

{
  "Success": true,
  "RequestId": "0000-ABCD-EFG\t",
  "Data": {
    "Status": "success",
    "Message": "read datasource time out",
    "Meta": "{\"dbTables\":[{\"dbName\":\"testdb\",\"schema\":[{\"tableInfos\":[{\"dbName\":\"testdb\",\"enable\":true,\"table\":\"table1\",\"tableName\":\"table1\"}]},{\"tableInfos\":[{\"dbName\":\"testdb\",\"enable\":true,\"table\":\"table2\",\"tableName\":\"table2\"}]}]}]}"
  }
}

Error codes

HTTP status codeError codeError message
400Invalid.DI.ParameterThe parameter is invalid.
403Forbidden.DI.NoPrivilegeNo access.
500InternalError.DI.ParameterA DI internal error occurred.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-11-14The Error code has changedView Change Details