Before you import a packaged flow into a Production environment, you may need to apply import rules to remap objects and locations from the source instance to the new instance. Import mapping rules are not required when importing into the same environment, although they may be helpful in some cases.
Tip: If you are importing a flow that references file-based sources and wish to use the original files in your imported file, you may find it easier to configure the importing user's permissions to access the appropriate directories of the sources and then to swap datasets as needed after you complete the import. This method is suitable and easier to do across a fewer number of flows. |
NOTE: Import mapping rules apply to deployments in a Production instance under deployment management. You cannot apply import mapping rules between two Dev instances. |
NOTE: Import mapping rules require the use of the APIs made available from the |
You can apply the following types of remappings:
Type | Description | |
---|---|---|
Value | For value remappings, you can specify rules to match on specific values or patterns of values in the import package and remap those values for use in the new instance.
| |
Object | For object remappings, you can specify rules to match a value listed in the import package and remap that value to a defined object in the new instance.
|
When a flow is imported, references in the flow definition that apply in the source instance may not apply in the target instance. For example, the location paths to the source datasets may need to be rewritten to point to a different location in the target instance.
Before you import your flow definition, you need to define rules for any value or object remapping that must be done in the target environment.
Value and object remapping rules should be completed before you import the flow. The flow may be non-functional until the rules are applied.
Tip: After you create your import rules, you can perform via API a dry run of the import. Any errors are reported in the response. Details are provided below. |
NOTE: Import mapping rules do not work for parameterized datasets. If the imported dataset with parameters is still accessible, you should be able to run jobs from it. |
The following are some example import rules to address specific uses.
In this following example, you must remap the connection from the source instance of the platform to the corresponding connection in the instance where you are importing.
First, you must be able to uniquely identify the connection from the source that you wish to remap.
In the API response in a connection definition, you can acquire the uuid
value for the connection, which is a unique identifier for the connection object across all instances of the platform:
Item | v4 APIs | |
---|---|---|
API Endpoint | From the source instance:
| |
Method |
| |
Request Body | None. | |
Response Body |
| |
Documentation | See
|
In the above, you identify that the connection used for the exported flow is the Redshift one. This object has the following unique identifier:
"uuid": "097c2300-2f6a-11e9-a585-57562e0d9cd6" |
In the target system, you must now create a rule in the deployment into which you are importing that searches for this unique value. In the following example:
4
.1
.The uuid
field in the import package is searched for the matching string. If it is found, the connection in the import package is replaced with the connection in the target system with an Id of 1
:
Item | v4 APIs | |
---|---|---|
API Endpoint |
| |
Method |
| |
Request Body |
| |
Status Code - Success | 200 - OK | |
Response Body | When the new rules are applied, all previously existing rules for the object in the deployment are deleted. The response body contains any rules that have been deleted as part of this request. In the following example, there were no rules, so nothing was deleted:
| |
Documentation | See
|
To test your rule, perform a dry run of the import. See below.
In this example, your import rule must remap the path to the source from your Dev paths to your Prod paths. Suppose the pattern looks like this:
Dev Path | hdfs://datasets/dev/1/164e0bca-8c91-4e3c-9d0a-2a85eedec817/myData.csv |
---|---|
Prod Path | hdfs://datasets/prod/1/164e0bca-8c91-4e3c-9d0a-2a85eedec817/myData-Prod.csv |
Note the differences:
/dev/
part of the path has been replaced by /prod/
.You can use the following value import rules to change the path values. In the following example, the rules are applied separately.
NOTE: You can specify multiple rules in a single request. Rules are applied in the order that they are listed. Latter rules must factor the results of earlier rules. |
Request:
Item | v4 APIs | |
---|---|---|
API Endpoint |
| |
Method |
|
Request Body:
[ {"type":"fileLocation","on":"/\/dev\//","with":"/prod/"}, {"type":"fileLocation","on":"/\/([a-zA-Z0-9_]*).csv/","with":"$1-Prod.csv"} ] |
Response:
Item | v4 APIs | |
---|---|---|
Status Code - Success | 200 - OK | |
Response Body | When the new rules are applied, all previously existing rules for the object in the deployment are deleted. The response body contains any rules that have been deleted as part of this request. In the following example, there were no rules, so nothing was deleted:
| |
Documentation | See
|
To test your rule, perform a dry run of the import. See below.
For S3 sources, you can apply remapping rules including changing to a new S3 bucket.
In this example, your import rule must remap the path to the source from your Dev paths to your Prod paths. Suppose the pattern looks like this:
Dev S3 Bucket Name | wrangle-dev |
---|---|
Dev Path | /projs/tweets/v04/tweets_month.csv |
Prod S3 Bucket Name | wrangle-prod |
Prod Path | /tweets/tweets_month.csv |
You can use the following value import rules to change the bucket name and path values.
NOTE: You can specify multiple rules in a single request. Rules are applied in the order that they are listed. Latter rules must factor the results of earlier rules. |
s3Bucket name rule: This rule replaces the name of the S3 bucket to use with the new one: wrangle-prod
.
fileLocation rule: This rule uses regular expressions to match each segment of the path in the source bucket's paths.
Request:
Item | v4 APIs | |
---|---|---|
API Endpoint |
| |
Method |
|
Request Body:
[ {"type":"s3Bucket","on":"wrangle-dev","with":"wrangle-prod"}, {"type":"fileLocation","on":"/\/([a-zA-Z0-9_]*)\/([a-zA-Z0-9_]*)\/([a-zA-Z0-9_]*)\/([a-zA-Z0-9_]*).csv/","with":"/$2/$4.csv"} ] |
Response:
Item | v4 APIs | |
---|---|---|
Status Code - Success | 200 - OK | |
Response Body | When the new rules are applied, all previously existing rules for the object in the deployment are deleted. The response body contains any rules that have been deleted as part of this request. In the following example, there were no rules, so nothing was deleted:
| |
Documentation | See
|
To test your rule, perform a dry run of the import. See below.
For WASB sources, you can apply remapping rules during import.
In this example, your import rule must remap the blob host, container, and file location:
Dev Blobhost | storage-wasb-account-dev.blob.core.windows.net |
---|---|
Dev Container | container-dev |
Dev File Location | /projs/work/orders.csv |
Prod Blobhost | storage-wasb-account-prod.blob.core.windows.net |
Prod Container | container-prod |
Prod File Location | /2003/transactions/orders.csv |
You can use the following value import rules to change the blobhost, container, and file paths.
NOTE: You can specify multiple rules in a single request. Rules are applied in the order that they are listed. Latter rules must factor the results of earlier rules. |
host rule: This rule replaces the blobhost name to use with the new one: storage-wasb-account-prod.blob.core.windows.net
.
userinfo rule: This rule replaces the container name to use with the new one: container-prod
.
fileLocation rule: This rule performs a text substitution to replace the file path. This rule applies to both input and output object file paths.
Request:
Item | v4 APIs | |
---|---|---|
API Endpoint |
| |
Method |
|
Request Body:
[ {"type":"host","on":"storage-wasb-account-dev.blob.core.windows.net","with":"storage-wasb-account-prod.blob.core.windows.net"}, {"type":"userinfo","on":"container-dev","with":"container-prod"}, {"type":"fileLocation","on":"/projs/work/orders.csv","with":"/2003/transactions/orders.csv"} ] |
Response:
Item | v4 APIs | |
---|---|---|
Status Code - Success | 200 - OK | |
Response Body | When the new rules are applied, all previously existing rules for the object in the deployment are deleted. The response body contains any rules that have been deleted as part of this request. In the following example, there were no rules, so nothing was deleted:
| |
Documentation | See
|
To test your rule, perform a dry run of the import. See below.
For ADLs Gen2 sources, you can apply remapping rules during import.
In this example, your import rule must remap the storage account, filesystem, and file location:
Dev Storage Account | storage-adlsgen2-account-dev.blob.core.windows.net |
---|---|
Dev Filesystem | filesystem-dev |
Dev File Location | /projs/work/orders.csv |
Prod Storage Account | storage-adlsgen2-account-prod.blob.core.windows.net |
Prod Filesystem | filesystem-prod |
Prod File Location | /2003/transactions/orders.csv |
You can use the following value import rules to change the storage account, filesystem, and file paths.
NOTE: You can specify multiple rules in a single request. Rules are applied in the order that they are listed. Latter rules must factor the results of earlier rules. |
host rule: This rule replaces the storage account name to use with the new one: storage-adlsgen2-account-prod.blob.core.windows.net
.
userinfo rule: This rule replaces the filesystem name to use with the new one: filesystem-prod
.
fileLocation rule: This rule performs a text substitution to replace the file path. This rule applies to both input and output object file paths.
Request:
Item | v4 APIs | |
---|---|---|
API Endpoint |
| |
Method |
|
Request Body:
[ {"type":"host","on":"storage-adlsgen2-account-dev.blob.core.windows.net","with":"storage-adlsgen2-account-prod.blob.core.windows.net"}, {"type":"userinfo","on":"filesystem-dev","with":"filesystem-prod"}, {"type":"fileLocation","on":"/projs/work/orders.csv","with":"/2003/transactions/orders.csv"} ] |
Response:
Item | v4 APIs | |
---|---|---|
Status Code - Success | 200 - OK | |
Response Body | When the new rules are applied, all previously existing rules for the object in the deployment are deleted. The response body contains any rules that have been deleted as part of this request. In the following example, there were no rules, so nothing was deleted:
| |
Documentation | See
|
To test your rule, perform a dry run of the import. See below.
For ADLS Gen1 sources, you can apply remapping rules during import.
In this example, your import rule must remap the Azure data lake store and file location:
Dev data store | adl://storage-adlsgen1-account.azuredatalakestore.net |
---|---|
Dev File Location | /projs/work/orders.csv |
Prod data store | adl://storage-adlsgen1-account-prod.azuredatalakestore.net |
Prod File Location | /2003/transactions/orders.csv |
You can use the following value import rules to change the datastore and file paths.
NOTE: You can specify multiple rules in a single request. Rules are applied in the order that they are listed. Latter rules must factor the results of earlier rules. |
host rule: This rule replaces the datastore name to use with the new one: storage-adlsgen1-account-prod.azuredatalakestore.net
.
fileLocation rule: This rule performs a text substitution to replace the file path. This rule applies to both input and output object file paths.
Request:
Item | v4 APIs | |
---|---|---|
API Endpoint |
| |
Method |
|
Request Body:
[ {"type":"host","on":"storage-adlsgen1-account-dev.azuredatalakestore.net","with":"storage-adlsgen1-account-prod.azuredatalakestore.net"}, {"type":"fileLocation","on":"/projs/work/orders.csv","with":"/2003/transactions/orders.csv"} ] |
Response:
Item | v4 APIs | |
---|---|---|
Status Code - Success | 200 - OK | |
Response Body | When the new rules are applied, all previously existing rules for the object in the deployment are deleted. The response body contains any rules that have been deleted as part of this request. In the following example, there were no rules, so nothing was deleted:
| |
Documentation | See
|
To test your rule, perform a dry run of the import. See below.
When you migrate a relational source from a Dev instance to a Prod instance, you may need to remap your flow to use the production database and table.
NOTE: These rules can be applied to sources or publications of a flow. |
In this example, you are replacing the input and output source databases and tables with the corresponding production DB values.
Item | Dev value | Prod value |
---|---|---|
Table name 1 | dev_trans | prod_trans |
Path value 1 | dev_db2_src | prod_db2_src |
Table name 2 | dev_trans_out | prod_trans_out |
Path value 2 | dev_db2_out | prod_db2_out |
In a single request, you can apply the rules changes to map the above Dev values to the Prod values.
NOTE: You can specify multiple rules in a single request. Rules are applied in the order that they are listed. Latter rules must factor the results of earlier rules. |
The on
parameter accepts regular expressions. In the following example request, the on
parameter has been configured to use a regular expression, under the assumption that all current and future imports will respect the current pattern or database paths and table names.
dbTableName rule: This rule replaces the name of the table to use.
dbPath rule: This rule replaces the path value to database table.
NOTE: The content of a dataset or output |
Request:
Item | v4 APIs | |
---|---|---|
API Endpoint |
| |
Method |
|
Request Body:
[ {"type":"dbTableName","on":"/dev_([a-zA-Z0-9_]*)/","with":"prod_$1"}, {"type":"dbPath","on":"/dev_([a-zA-Z0-9_]*)_src/","with":"prod_$1_out"} ] |
Response:
Item | v4 APIs | |
---|---|---|
Status Code - Success | 200 - OK | |
Response Body | When the new rules are applied, all previously existing rules for the object in the deployment are deleted. The response body contains any rules that have been deleted as part of this request. In the following example, there were no rules, so nothing was deleted:
| |
Documentation | See
|
To test your rule, perform a dry run of the import. See below.
After you have specified a set of import rules, you can perform a dry-run of an import of an import package. This dry-run does not perform the actual import but does report any permissions errors or other issues in the response.
In this example, the flow2import.zip
file contains the package to import into deployment 4
.
Request:
Item | v4 APIs | ||||
---|---|---|---|---|---|
API Endpoint |
| ||||
Method |
| ||||
Request Body | In form data submitted with the request, you must include the following key-value pair:
|
Response:
Item | v4 APIs | |
---|---|---|
Status Code - Success | 200 - OK | |
Response Body | The response body contains any import remapping rules that have been applied during the import process. | |
Documentation | See
|
After the above dry-run has been executed, the import package can be imported and is automatically connected to the appropriate connection. See
operation/importPackageForDeployment |