全部产品
Search
文档中心

大数据开发治理平台 DataWorks:UpdateDataSource - 更新数据源

更新时间:Aug 28, 2026

该接口用于更新数据源。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

当前API暂无授权信息透出。

请求参数

名称

类型

必填

描述

示例值

Description

string

否

数据源的描述信息。

xxx

EnvType

integer

否

数据源所在的环境。取值如下:

  • 0:开发环境。

  • 1:生产环境。

1

Content

string

否

需要修改的目标数据源的详细信息。 不支持修改数据源的类型,例如,您不可以修改 odps 类型的数据源为 MySQL 类型。 部分常用数据源的信息样例如下:

  • odps

    {
      "accessId": "*****",
      "accessKey": "*****",
      "authType": 2,
      "endpoint": "http://service.odps.aliyun.com/api",
      "project": "xsaxsax",
      "tag": "public"
    }
    

  • mysql

    {
      "database": "xsaxsa",
      "instanceName": "rm-xsaxsa",
      "password": "xsaxsa",
      "rdsOwnerId": "xasxsa",
      "regionId": "cn-shanghai",
      "tag": "rds",
      "username": "xsaxsa"
    }
    

  • rds

    {
      "configType": 1,
      "tag": "rds",
      "database": "xsaxsa",
      "username": "xsaxsa",
      "password": "xssaxsa$32050",
      "instanceName": "rm-xsaxs",
      "rdsOwnerId": "11111111"
    }
    

  • oss

    {
      "accessId": "*****",
      "accessKey": "*****",
      "bucket": "xsa-xs-xs",
      "endpoint": "http://oss-cn-shanghai.aliyuncs.com",
      "tag": "public"
    }
    

  • sqlserver

    {
      "jdbcUrl": "jdbc:sqlserver://xsaxsa-xsaxsa.database.xxx.cn:123;DatabaseName=xsxs-xsxs",
      "password": "sdasda$fs",
      "tag": "public",
      "username": "sxaxacdacdd"
    }
    

  • polardb

    {
      "clusterId": "pc-sdadsadsa",
      "database": "dsadsadsa",
      "ownerId": "121212122",
      "password": "sdasdafssa",
      "region": "cn-shanghai",
      "tag": "polardb",
      "username": "asdadsads"
    }
    

  • oracle

    {
      "jdbcUrl": "jdbc:oracle:saaa:@xxxxx:1521:PROD",
      "password": "sxasaxsa",
      "tag": "public",
      "username": "sasfadfa"
    }
    

  • mongodb

    {
      "address": "[\"xsaxxsa.mongodb.rds.aliyuncs.com:3717\"]",
      "database": "admin",
      "password": "sadsda@",
      "tag": "public",
      "username": "dsadsadas"
    }
    

  • emr

    {
      "accessId": "*****",
      "emrClusterId": "C-dsads",
      "emrResourceQueueName": "default",
      "emrEndpoint": "emr.aliyuncs.com",
      "accessKey": "*****",
      "emrUserId": "224833315798889783",
      "name": "sasdsadsa",
      "emrAccessMode": "simple",
      "region": "cn-shanghai",
      "authType": "2",
      "emrProjectId": "FP-sdadsad"
    }
    

  • postgresql

    {
      "jdbcUrl": "jdbc:postgresql://xxxx:1921/ssss",
      "password": "sdadsads",
      "tag": "public",
      "username": "sdsasda"
    }
    

  • analyticdb_for_mysql

    {
      "instanceId": "am-sadsada",
      "database": "xsxsx",
      "username": "xsxsa",
      "password": "asdadsa",
      "connectionString": "am-xssxsxs.ads.aliyuncs.com:3306"
    }
    

  • hybriddb_for_postgresql

    {
      "connectionString": "gp-xsaxsaxa-master.gpdbmaster.rds.aliyuncs.com",
      "database": "xsaxsaxas",
      "password": "xsaxsaxsa@11",
      "instanceId": "gp-xsaxsaxsa",
      "port": "541132",
      "ownerId": "xsaxsaxsas",
      "username": "sadsad"
    }
    

  • holo

    {
      "accessId": "*****",
      "accessKey": "*****",
      "database": "xsaxsaxsa",
      "instanceId": "xsaxa",
      "tag": "aliyun"
    }
    

  • kafka

    {
      "instanceId": "xsax-cn-xsaxsa",
      "regionId": "cn-shanghai",
      "tag": "aliyun",
      "ownerId": "1212121212112"
    }
    

{"accessId":"*****","accessKey":"*****","authType":2,"endpoint":"http://service.odps.aliyun.com/api","project":"xsaxsax","tag":"public"}

Status

string

否

数据源的状态。该字段已废弃,请勿使用。

ENABLED

DataSourceId

integer

是

需要更新的数据源 ID,您可以调用 ListDataSources 获取数据源的 ID。

1

返回参数

名称

类型

描述

示例值

object

返回结果。

HttpStatusCode

string

请求返回码。

200

Data

boolean

是否成功更新数据源。

true

RequestId

string

请求 ID。

0bc14115159376359****

Success

boolean

请求是否成功。

true

示例

正常返回示例

JSON格式

{
  "HttpStatusCode": "200",
  "Data": true,
  "RequestId": "0bc14115159376359****",
  "Success": true
}

错误码

HTTP status code

错误码

错误信息

描述

400 Invalid.Tenant.ConnectionNotExists The connection does not exist. 数据源不存在。
400 Invalid.Tenant.ProjectNotExists The project does not exist. 项目不存在。
400 Invalid.Tenant.UserNotInProject The user is not in the project. 用户不在项目中。
400 MissingParam.ConnectionStr.Property You must specify property %s required by the data source connection string. 数据源连接串信息必填属性缺失
400 DataSource.CheckRamRoleFailure Failed to check the RAM role. AccountId %s. roleArn %s. 校验数据源权限失败
400 DataSource.ConnectionStrProperty.PatternNotMatch The pattern value %s is invalid. The correct pattern is %s. 数据源连接串属性不匹配规则
400 DataSource.NotFound The specified data source ID %s does not exist. 数据源不存在
400 Invalid.Connection.Empty You must specify the connection parameter. 数据源参数为空
400 Invalid.DataSource.DataSourceTypeNotExist The data source type %s does not exist. 数据源类型不存在。
400 Invalid.DataSource.DataSourceTypeNotSupport The dataSourceType %s and subType %s are not supported. 数据源类型暂不支持
400 Invalid.Operation You cannot delete the bindingCalcEngine that is bound to the data source. 数据源绑定的计算引擎不允许删除
400 Invalid.Param.Odps.EngineIdOrConnectStrEmpty Either the compute engine ID or the connection string must be specified when data source type is ODPS.
400 Required.Parameter.Empty You must specify the parameter %s. 必填参数缺失
403 Invalid.Tenant.UserIsNotProjectOwnerOrAdmin The user is not a project administrator or owner. 用户不是项目负责人或者项目管理员。
403 Invalid.Tenant.UserNotInTenant The user is not in tenant. 用户不在租户中。

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情。