Overview
The ability to export object definitions to a CSV file and then import them to another environment provides many benefits, enabling:
- Migration of data from a custom database table and/or Excel sheets to Compose
- Data to be reviewed by business analysts who are not able to (or do not want to) access Compose
- Synching with third-party tools that output data in CSV format
- Comparison of versions in order to review changes
- Resolving of object-specific issues in a development environment and then deploying to the production environment, even when they are not completely in sync
- Sharing of resources between projects in the same environment
- Granular version management of specific objects such as mappings
Manually typing these definitions into Compose would be a laborious and time-consuming undertaking; using the CLI however, this can be done in a matter of minutes. Following the initial import, customers who need to apply selective updates to the target environment (such as adding attributes with their descriptions), can do so using the Compare and Apply CLI commands.
A typical workflow would be as follows:
- Run the export command to output the source object(s) (to CSV files).
- Run the import command to bring the objects into the target environment.
- Following changes to the source environment, run the export command to output the source object(s) to (CSV files).
-
Run the Compare command to see the differences between the exported objects and the corresponding target objects.
Alternatively, run the Compare command on the source environment to see the differences between previous and current source project versions; then determine which changes needs to be migrated to the target project. This approach is useful if changes were made directly to the target project as it allows you to retain the custom changes while still applying changes to other objects.
- Review the changes and make any edits as necessary.
- Run the Apply command to apply the changes to the target environment.
- Periodically repeat steps 3-6 as necessary.
An understanding of the CSV file structure and their impact on the target environment is crucial, not only for customers who wish to create these files manually, but also for ensuring the import/apply operations succeed with the expected results. For this reason, this section first discusses the CSV file structure of the supported objects and only then provides instructions for performing the actual CLI operations.
-
Only import of new objects is supported.
- UPDATEs and DELETEs will be ignored by the Apply command (which supports ADD operations only), but can still be applied manually if needed.
Valid CSV file formats
CSV files must be in a valid format; otherwise, the import/compare/apply operation will fail.
CSV formatting rules:
- Fields must be separated with a comma.
- The first line must be a header line which contains the column names.
- The escaping convention is similar to Excel:
- If a field contains a comma, then the comma must be wrapped with quotation marks, for example: "a,b"
-
If the value contains a quotation mark, then ithe quotation mark must be doubled. For example:
"Mike ""The Hammer"" Smith"
-
If the value contains a new line, then it must be wrapped with double quotes. For example:
"Field owned by Mike.
Comment added by Shelley."
Stored objects
Several objects may have multi-lines, commas, and other such complexities.
Expressions, for example, are stored as two fields:
First field - expression value:
Example:
${x1}*${x2}
Note: The expression may need to be escaped.
Second field - semicolon parameters mappings:
Example:
x1:unit price;x2:quantity