ListDataSources

Updated at:

Queries the list of data sources in DataWorks.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dataworks:*

list

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

ProjectId

integer

Yes

The ID of the DataWorks workspace to which the data source belongs. You can obtain the workspace ID by calling the ListProjects operation.

1

Name

string

No

The name of the data source to query.

test

DataSourceType

string

No

The type of the data source. Common types include:

  • odps

  • mysql

  • rds

  • oss

  • sqlserver

  • polardb

  • oracle

  • mongodb

  • emr

  • postgresql

  • analyticdb_for_mysql

  • hybriddb_for_postgresql

  • holo

rds

SubType

string

No

The subtype of the data source. This parameter takes effect only when DataSourceType is set to RDS.

When DataSourceType is set to RDS, you can set this parameter to mysql, sqlserver, or postgresql.

mysql

Status

string

No

The status of the data source. Valid values:

  • ENABLED: Normal.

  • DISABLED: Disabled.

ENABLED

EnvType

integer

No

The environment to which the data source belongs. Valid values: 0 (development environment) and 1 (production environment).

1

PageSize

integer

No

The number of entries to return on each page. Default value: 10. Maximum value: 100.

10

PageNumber

integer

No

The page number for paging. The value must be a positive integer greater than or equal to 1.

1

Response elements

Element

Type

Description

Example

object

The response structure.

HttpStatusCode

integer

The HTTP status code.

200

RequestId

string

The request ID.

0bc14115159376359****

Success

boolean

Indicates whether the request is successful.

true

Data

object

The query result of the data sources.

PageNumber

integer

The page number.

1

PageSize

integer

The number of entries returned per page.

20

TotalCount

integer

The total number of data sources.

233

DataSources

array<object>

The list of data sources.

object

The data source details.

Status

integer

The status of the data source. Valid values:

  • 1: The data source is in normal use.

  • 2: The data source is disabled.

1

ProjectId

integer

The ID of the workspace associated with the data source.

123

SubType

string

The subtype of the data source. This parameter takes effect only when DataSourceType is set to RDS.

mysql

GmtModified

string

The time when the data source was modified. Example: Mar 17, 2021 4:09:32 PM.

Mar 17, 2021 4:09:32 PM

EnvType

integer

The environment where the data source resides. Valid values:

  • 0: development environment.

  • 1: production environment.

1

ConnectStatus

integer

The status of the data source. Valid values:

  • 1: The data source is in normal use.

  • 2: The data source is disabled.

1

Sequence

integer

The sorting field. Data sources are sorted in descending order based on this field.

300

Description

string

The description of the data source.

a connection

DataSourceType

string

The type of the data source. Common types include:

  • odps

  • mysql

  • rds

  • oss

  • sqlserver

  • polardb

  • oracle

  • mongodb

  • emr

  • postgresql

  • analyticdb_for_mysql

  • hybriddb_for_postgresql

  • holo

rds

GmtCreate

string

The time when the data source was created. Example: Mar 17, 2021 4:09:32 PM.

Mar 17, 2021 4:09:32 PM

DefaultEngine

boolean

Indicates whether the engine associated with the data source is the default engine selected for data sources of the same type.

false

Shared

boolean

Indicates whether the data source is shared.

false

Operator

string

The ID of the Alibaba Cloud user who last modified the data source.

193543050****

Name

string

The name of the data source.

abc

Content

string

The information about the data connection string. The format is JSON. Examples of connection strings for common data sources:

  • MaxCompute

    {
      "pubEndpoint": "http://service.cn.maxcompute.aliyun.com/api",
      "accessId": "xxxxxxx",
      "securityToken": null,
      "endpoint": "http://service.cn.maxcompute.aliyun-inc.com/api",
      "accessKey": "***",
      "name": "PRE_PROJECT_A_engine",
      "project": "PRE_PROJECT_A",
      "vpcEndpoint": "http://service.cn.maxcompute.aliyun-inc.com/api",
      "region": "cn-shanghai",
      "authType": "2"
    }
    

  • mysql

    {
      "configType": "1",
      "database": "mysql_d111b",
      "instanceName": "rm-xxxxxx",
      "password": "***",
      "rdsOwnerId": "12133xxxxxx",
      "tag": "rds",
      "username": "mysql_db111"
    }
    

  • SQL Server

    {
      "configType": "1",
      "jdbcUrl": "jdbc:sqlserver://rm-xxxxx.sqlserver.rds.aliyuncs.com:1433;DatabaseName=sqlserver_db1",
      "password": "***",
      "tag": "public",
      "username": "sqlserver_db111"
    }
    

  • oss

    {
      "accessId": "***********",
      "accessKey": "***********",
      "bucket": "bigxxx1223",
      "configType": "1",
      "endpoint": "http://oss-cn-hangzhou.aliyuncs.com",
      "tag": "public"
    }
    

  • postgresql

    {
      "configType": "1",
      "database": "cdp_xxx",
      "instanceName": "rm-xxxx",
      "password": "***",
      "rdsOwnerId": "121xxxxx",
      "tag": "rds",
      "username": "cdp_xxx"
    }
    

  • AnalyticDB

    {
      "configType": "1",
      "password": "***",
      "schema": "ads_demo",
      "tag": "public",
      "url": "ads-xxx-xxxx.cn-hangzhou-1.ads.aliyuncs.com:3029",
      "username": "lslslsls"
    }
    

{"pubEndpoint":"http://service.cn.maxcompute.aliyun.com/api","accessId":"TMP.3KecGjvzy3i8MYfn2BGHgF7EHGyBFZcHm7GgngrABVRyvvKQrfF5kskR36xP361C3dqwbGo7SGYptAeGyiTwHXqLaBUvYC","securityToken":null,"endpoint":"http://service.cn.maxcompute.aliyun-inc.com/api","accessKey":"***","name":"PRE_PROJECT_A_engine","project":"PRE_PROJECT_A","vpcEndpoint":"http://service.cn.maxcompute.aliyun-inc.com/api","region":"cn-shanghai","authType":"2"}

Id

integer

The data source ID.

1

BindingCalcEngineId

integer

The ID of the compute engine associated with the data source.

123

TenantId

integer

The tenant ID.

1234567

Examples

Success response

JSON format

{
  "HttpStatusCode": 200,
  "RequestId": "0bc14115159376359****",
  "Success": true,
  "Data": {
    "PageNumber": 1,
    "PageSize": 20,
    "TotalCount": 233,
    "DataSources": [
      {
        "Status": 1,
        "ProjectId": 123,
        "SubType": "mysql",
        "GmtModified": "Mar 17, 2021 4:09:32 PM",
        "EnvType": 1,
        "ConnectStatus": 1,
        "Sequence": 300,
        "Description": "a connection",
        "DataSourceType": "rds",
        "GmtCreate": "Mar 17, 2021 4:09:32 PM",
        "DefaultEngine": false,
        "Shared": false,
        "Operator": "193543050****",
        "Name": "abc",
        "Content": "{\"pubEndpoint\":\"http://service.cn.maxcompute.aliyun.com/api\",\"accessId\":\"TMP.3KecGjvzy3i8MYfn2BGHgF7EHGyBFZcHm7GgngrABVRyvvKQrfF5kskR36xP361C3dqwbGo7SGYptAeGyiTwHXqLaBUvYC\",\"securityToken\":null,\"endpoint\":\"http://service.cn.maxcompute.aliyun-inc.com/api\",\"accessKey\":\"***\",\"name\":\"PRE_PROJECT_A_engine\",\"project\":\"PRE_PROJECT_A\",\"vpcEndpoint\":\"http://service.cn.maxcompute.aliyun-inc.com/api\",\"region\":\"cn-shanghai\",\"authType\":\"2\"}",
        "Id": 1,
        "BindingCalcEngineId": 123,
        "TenantId": 1234567
      }
    ]
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 Invalid.Tenant.ConnectionNotExists The connection does not exist. The connection does not exist.
400 Invalid.Tenant.ProjectNotExists The project does not exist. The project does not exist.
400 Invalid.Tenant.UserNotInProject The user is not in the project. The user is not in the project.
403 Invalid.Tenant.UserIsNotProjectOwnerOrAdmin The user is not a project administrator or owner. The user is not a project administrator or owner.
403 Invalid.Tenant.UserNotInTenant The user is not in tenant. The user is not in tenant.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.