全部產品
Search
文件中心

DataWorks:UpdateDataSource - 更新資料來源

更新時間:Mar 21, 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. 使用者不在租戶中。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情