CreateImportMigration

Updated at:

Creates an import task. The import task contains the import packages of data sources, nodes, and tables.

Operation description

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

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dataworks:*

update

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

ProjectId

integer

Yes

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

123456

Name

string

Yes

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

test_import_001

PackageType

string

Yes

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)

DATAWORKS_MODEL

PackageFile

string

Yes

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

/home/admin/xxx/import.zip

ResourceGroupMap

string

No

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"
    }
}

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

WorkspaceMap

string

No

When an import or export operation is performed, this mapping replaces the input and output workspace names in the import/export package with the mapped workspace names. For example, during import, the workspace name prefixes in inputs and outputs are replaced based on the mapping.

{"test_workspace_src": "test_workspace_target"}

CalculateEngineMap

string

No

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.

{ "ODPS": { "zxy_8221431_engine": "wzp_kaifazheban_engine" }, "EMR": { "aaaa": "bbb" } }

CommitRule

string

No

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 forcefully 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.

{ "resourceAutoCommit": false, "resourceAutoDeploy": false, "functionAutoCommit": false, "functionAutoDeploy": false, "tableAutoCommitToDev": false, "tableAutoCommitToProd": false, "ignoreLock": false, "fileAutoCommit": false, "fileAutoDeploy": false }

Description

string

No

The description of the import package.

test description

Response elements

Element

Type

Description

Example

object

The returned data.

HttpStatusCode

integer

The HTTP status code.

200

Data

integer

The import/export package 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.

123456

ErrorMessage

string

The error message.

test error message

RequestId

string

The request ID. You can locate logs and troubleshoot issues based on the ID.

ADFASDFASDFA-ADFASDF-ASDFADSDF-AFFADS

ErrorCode

string

The error code.

110001123456

Success

boolean

Indicates whether the request was successful.

true

Examples

Success response

JSON format

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

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.