Creates an import task. The import task contains the import packages of the data sources, nodes, and tables.
The import package must be uploaded. Example of the upload method:
Config config = new Config();
config.setAccessKeyId(accessId);
config.setAccessKeySecret(accessKey);
config.setEndpoint(popEndpoint);
config.setRegionId(regionId);
Client client = new Client(config);
CreateImportMigrationAdvanceRequest request = new CreateImportMigrationAdvanceRequest();
request.setName("test_migration_api_" + System.currentTimeMillis());
request.setProjectId(123456L);
request.setPackageType("DATAWORKS_MODEL");
request.setPackageFileObject(new FileInputStream("/home/admin/Downloads/test.zip"));
RuntimeOptions runtime = new RuntimeOptions();
CreateImportMigrationResponse response = client.createImportMigrationAdvance(request, runtime);
...
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateImportMigration |
The operation that you want to perform. |
CalculateEngineMap | String | Yes | { "ODPS": { "zxy_8221431_engine": "wzp_kaifazheban_engine" }, "EMR": { "aaaa": "bbb" } } |
The mapping between the source compute engine instance and the destination compute engine instance. The following types of compute engine instances are supported: MaxCompute, E-MapReduce (EMR), Hadoop CDH, and Hologres. |
CommitRule | String | Yes | { "resourceAutoCommit": false, "resourceAutoDeploy": false, "functionAutoCommit": false, "functionAutoDeploy": false, "tableAutoCommitToDev": false, "tableAutoCommitToProd": false, "ignoreLock": false, "fileAutoCommit": false, "fileAutoDeploy": false } |
The rule configured for automatically committing and deploying the import task. The rule contains the following parameters:
|
Name | String | Yes | test_import_001 |
The name of the import task. The name must be unique within the workspace. |
PackageFile | String | Yes | /home/admin/xxx/import.zip |
The path of the import package. The import package must be uploaded. Example of the upload method: Config config = new Config(); config.setAccessKeyId(accessId); config.setAccessKeySecret(accessKey);
config.setEndpoint(popEndpoint); config.setRegionId(regionId); Client client = new
Client(config); CreateImportMigrationAdvanceRequest request = new CreateImportMigrationAdvanceRequest();
request.setName("test_migration_api_" + System.currentTimeMillis()); request.setProjectId(123456L);
request.setPackageType("DATAWORKS_MODEL"); request.setPackageFileObject(new FileInputStream("/home/admin/Downloads/test.zip"));
RuntimeOptions runtime = new RuntimeOptions(); CreateImportMigrationResponse response
= client.createImportMigrationAdvance(request, runtime); ... |
PackageType | String | Yes | DATAWORKS_MODEL |
The type of the import package. Valid values:
|
ProjectId | Long | Yes | 123456 |
The ID of the DataWorks workspace. You can log on to the DataWorks console and go to the Workspace Management page to obtain the ID. |
RegionId | String | Yes | cn-shanghai-fiance-1 |
The region ID. For example, the ID of the China (Shanghai) region is cn-shanghai, and that of the China (Zhangjiakou) region is cn-zhangjiakou. The system automatically determines the value of this parameter based on the endpoint used to call the operation. |
ResourceGroupMap | String | No | {"SCHEDULER_RESOURCE_GROUP": {"xxx":"yyy"},"DI_RESOURCE_GROUP":{"ccc":"ddd"}} |
The mapping between the resource group for scheduling and the resource group for Data Integration. The keys and values in the mapping are the identifiers of the resource groups. Specify the mapping in the following format:
|
WorkspaceMap | String | No | {"test_workspace_src": "test_workspace_target"} |
The mapping between the prefixes for the names of the source and destination workspaces. When the system performs the import operation, the prefix for the name of the source workspace in the import package is replaced based on the mapping. |
Description | String | No | test description |
The description of the import package. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Data | Long | 123456 |
The ID of the import task. The ID is used as an input parameter if you want the system to run the import task or you want to obtain the running progress of the import task. |
ErrorCode | String | 110001123456 |
The error code returned. |
ErrorMessage | String | test error message |
The error message returned. |
HttpStatusCode | Integer | 200 |
The HTTP status code returned. |
RequestId | String | ADFASDFASDFA-ADFASDF-ASDFADSDF-AFFADS |
The ID of the request. You can use the ID to locate logs and troubleshoot issues. |
Success | Boolean | true |
Indicates whether the request is successful. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=CreateImportMigration
&CalculateEngineMap={ "ODPS": { "zxy_8221431_engine": "wzp_kaifazheban_engine" }, "EMR": { "aaaa": "bbb" } }
&CommitRule={ "resourceAutoCommit": false, "resourceAutoDeploy": false, "functionAutoCommit": false, "functionAutoDeploy": false, "tableAutoCommitToDev": false, "tableAutoCommitToProd": false, "ignoreLock": false, "fileAutoCommit": false, "fileAutoDeploy": false }
&Name=test_import_001
&PackageFile=/home/admin/xxx/import.zip
&PackageType=DATAWORKS_MODEL
&ProjectId=123456
&RegionId=cn-shanghai-fiance-1
&<Common request parameters>
Sample success responses
XML
format
<RequestId>ADFASDFASDFA-ADFASDF-ASDFADSDF-AFFADS</RequestId>
<HttpStatusCode>200</HttpStatusCode>
<Data>123456</Data>
<ErrorCode>110001123456</ErrorCode>
<ErrorMessage>test error message</ErrorMessage>
<Success>true</Success>
JSON
format
{
"RequestId": "ADFASDFASDFA-ADFASDF-ASDFADSDF-AFFADS",
"HttpStatusCode": 200,
"Data": 123456,
"ErrorCode": 110001123456,
"ErrorMessage": "test error message",
"Success": true
}
Error codes
For a list of error codes, visit the API Error Center.