CreateImportMigration
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
Test
RAM authorization
|
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:
Valid values:
|
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:
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":"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": 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.