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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

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:

  • resourceAutoCommit: specifies whether resources are automatically committed. The value true indicates that the resources are automatically committed, and the value false indicates that the resources are not automatically committed.
  • resourceAutoDeploy: specifies whether resources are automatically deployed. The value true indicates that the resources are automatically deployed, and the value false indicates that the resources are not automatically deployed.
  • functionAutoCommit: specifies whether the function is automatically committed. The value true indicates that the function is automatically committed, and the value false indicates that the function is not automatically committed.
  • functionAutoDeploy: specifies whether the function is automatically deployed. The value true indicates that the function is automatically deployed, and the value false indicates that the function is not automatically deployed.
  • tableAutoCommitToDev: specifies whether the table is automatically committed to the development environment. The value true indicates that the table is automatically committed to the development environment, and the value false indicates that the table is not automatically committed to the development environment.
  • tableAutoCommitToProd: specifies whether the table is automatically committed to the production environment. The value true indicates that the table is automatically committed to the production environment, and the value false indicates that the table is not automatically committed to the production environment.
  • ignoreLock: specifies whether the lock is automatically ignored when an import task is locked. The value true indicates that the lock is automatically ignored, and the value false indicates that the lock is not automatically ignored. If you set this parameter to true for an import task, you can forcibly update the task even if the task is locked.
  • fileAutoCommit: specifies whether the file is automatically committed. The value true indicates that the file is automatically committed, and the value false indicates that the file is not automatically committed.
  • fileAutoDeploy: specifies whether the file is automatically deployed. The value true indicates that the file is automatically deployed, and the value false indicates that the file is not automatically deployed.
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:

  • DATAWORKS_MODEL (standard format)
  • DATAWORKS_V2 (Apsara Stack DataWorks V3.6.1 to V3.11)
  • DATAWORKS_V3 (Apsara Stack DataWorks V3.12 and later)
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:


{
    "SCHEDULER_RESOURCE_GROUP": {
        "xxx": "yyy"
    },
    "DI_RESOURCE_GROUP": {
        "ccc": "dfdd"
    }
}

                                
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.