All Products
Search
Document Center

:CreateImportMigration

最終更新日:May 13, 2024

Creates an import task that contains the import packages of the data sources, tasks, 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. Set the value to CreateImportMigration.

ProjectId

Long

Yes

123456

The DataWorks workspace ID. You can log on to the DataWorks console and go to the Workspace page to obtain the workspace ID.

Name

String

Yes

test_import_001

The name of the import task. The name must be unique within the workspace.

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)

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:

java
        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);

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:

json
{
    "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.

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 yes and the value false indicates no.

  • resourceAutoDeploy: specifies whether resources are automatically deployed. The value true indicates yes and the value false indicates no.

  • functionAutoCommit: specifies whether the function is automatically committed. The value true indicates yes and the value false indicates no.

  • functionAutoDeploy: specifies whether the function is automatically deployed. The value true indicates yes and the value false indicates no.

  • tableAutoCommitToDev: specifies whether the table is automatically committed to the development environment. The value true indicates yes and the value false indicates no.

  • tableAutoCommitToProd: specifies whether the table is automatically committed to the production environment. The value true indicates yes and the value false indicates no.

  • ignoreLock: specifies whether the lock is automatically ignored when an import task is locked. The value true indicates yes and the value false indicates no. 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 yes and the value false indicates no.

  • fileAutoDeploy: specifies whether the file is automatically deployed. The value true indicates yes and the value false indicates no.

Description

String

No

test description

The description of the import package.

Response parameters

Parameter

Type

Example

Description

HttpStatusCode

Integer

200

The HTTP status code.

Data

Long

123456

The import task ID. 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.

ErrorMessage

String

test error message

The error message.

RequestId

String

ADFASDFASDFA-ADFASDF-ASDFADSDF-AFFADS

The request ID. You can use the ID to locate logs and troubleshoot issues.

ErrorCode

String

110001123456

The error code.

Success

Boolean

true

Indicates whether the request was successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateImportMigration
&ProjectId=123456
&Name=test_import_001
&PackageType=DATAWORKS_MODEL
&PackageFile=/home/admin/xxx/import.zip
&ResourceGroupMap={"SCHEDULER_RESOURCE_GROUP": {"xxx":"yyy"},"DI_RESOURCE_GROUP":{"ccc":"ddd"}}
&WorkspaceMap={"test_workspace_src": "test_workspace_target"}
&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   }
&Description=test description
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateImportMigrationResponse>
    <HttpStatusCode>200</HttpStatusCode>
    <Data>123456</Data>
    <ErrorMessage>test error message</ErrorMessage>
    <RequestId>ADFASDFASDFA-ADFASDF-ASDFADSDF-AFFADS</RequestId>
    <ErrorCode>110001123456</ErrorCode>
    <Success>true</Success>
</CreateImportMigrationResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "HttpStatusCode" : 200,
  "Data" : 123456,
  "ErrorMessage" : "test error message",
  "RequestId" : "ADFASDFASDFA-ADFASDF-ASDFADSDF-AFFADS",
  "ErrorCode" : "110001123456",
  "Success" : true
}

Error codes

For a list of error codes, see Service error codes.