CreateImportMigration

Updated at:

Creates an import task to import a DataWorks import and export package that contains objects such as data sources, nodes, and tables.

Operation description

Note: This operation involves file upload. The following example shows how to call this operation:

    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 ID of the DataWorks workspace. You can log on to the DataWorks console and go to the Workspace Configuration 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 and export package. Valid values:

  • DATAWORKS_MODEL: standard format.

  • DATAWORKS_V2: Apsara Stack (V3.6.1 to V3.11).

  • DATAWORKS_V3: Apsara Stack (V3.12 and later).

Valid values:

  • DATAWOKRS_V2 :

    Apsara Stack V3.6.1 to V3.11 import package (the enum identifier is spelled differently from the server-side value)

  • DATAWORKS_V3 :

    Apsara Stack V3.12 and later import package.

  • DATAWORKS_MODEL :

    DataWorks standard format import package.

  • SPEC :

    Spec format import package.

DATAWORKS_MODEL

PackageFile

string

Yes

The path of the import package file. Note: This operation involves file upload. The following example shows how to call this operation:

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

If you directly pass the file path, the parameter value must be a valid URL of an Object Storage Service (OSS) object under the caller's account, such as https://{bucket}.oss-{region}.aliyuncs.com/{object_key}. Cross-account OSS URLs are rejected. If you use the SDK Advance method, you can upload the file by using a local file stream.

/home/admin/xxx/import.zip

ResourceGroupMap

string

No

The mapping between scheduling resource groups and data integration resource groups. Both the keys and values in the mapping are resource group identifiers. The format is as follows:

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

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

WorkspaceMap

string

No

The mapping used to change the input and output workspace names in the import and export package to the mapped workspace names during import and export operations. For example, during an import operation, the prefixes of the input and output workspace names are replaced based on the mapping.

{"test_workspace_src": "test_workspace_target"}

CalculateEngineMap

string

Yes

The mapping between the source compute engine instances to be imported and the destination compute engine instances to be exported in the import task. The compute engine types include ODPS, EMR, HADOOP_CDH, and HOLOGRES.

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

CommitRule

string

Yes

The rules for automatically committing and deploying nodes during the import operation. The parameters are as follows:

  • resourceAutoCommit: Specifies whether to automatically commit resources. A value of true indicates yes, and a value of false indicates no.

  • resourceAutoDeploy: Specifies whether to automatically deploy resources. A value of true indicates yes, and a value of false indicates no.

  • functionAutoCommit: Specifies whether to automatically commit functions. A value of true indicates yes, and a value of false indicates no.

  • functionAutoDeploy: Specifies whether to automatically deploy functions. A value of true indicates yes, and a value of false indicates no.

  • tableAutoCommitToDev: Specifies whether to automatically commit tables to the development environment. A value of true indicates yes, and a value of false indicates no.

  • tableAutoCommitToProd: Specifies whether to automatically commit tables to the production environment. A value of true indicates yes, and a value of false indicates no.

  • ignoreLock: Specifies whether to automatically bypass locks. A value of true indicates yes, and a value of false indicates no. If a node is locked by another user for editing, you can force update the current node by choosing to bypass the lock.

  • fileAutoCommit: Specifies whether to automatically commit files. A value of true indicates yes, and a value of false indicates no.

  • fileAutoDeploy: Specifies whether to automatically deploy files. A value of true indicates yes, and a value of 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 and export package.

test description

Response elements

Element

Type

Description

Example

object

The response data.

HttpStatusCode

integer

The HTTP status code.

200

Data

integer

The ID of the import and export package. You can use this ID as an input parameter to execute the import task or query the execution progress of the import task.

123456

ErrorMessage

string

The error message.

test error message

RequestId

string

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

ADFASDFASDFA-ADFASDF-ASDFADSDF-AFFADS

ErrorCode

string

The error code.

110001123456

Success

boolean

Indicates whether the call 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.