Migrating models
Migrating a Compose Model allows you to:
- Import existing column definitions (i.e. definitions stored independently of Compose) to a Compose project
- Reuse the same Model across several projects or Compose installations
Model objects
A Compose Model consists of the following objects:
- Entities (entities.csv)
- Attributes (attributes.csv)
- Attributes Domain (attributesDomain.csv)
- Relationships (relationships.csv)
During the export process, each of these objects is exported to a separate CSV file.
You can either import the Model in its entirety or only specific elements, according to your needs. You can also manually create a CSV file containing a Model element (or edit an existing file) and then import it to a Compose project.
-
The Model must be valid before you can export it to or import it from a CSV file. For details, see Validating the model.
- CSV files must be in a valid format. For details, see Valid CSV File Formats.
-
Only a user with Model privileges can import the Model.
Non-privileged users can import just the mappings. For details, see the SCOPE parameter in the command for importing a model.
- Replacing an existing object is not supported. For example, if the Products entity already exists in the Model, you cannot import an entities.csv file that contains an entity called Products.
Guidelines for exporting a Compose model
Note the following:
- For Boolean fields, accepted values are True/False
- Data type is the Compose logical type
- The order of writing the attributes is according to the ordinal in the entity. Primary Keys will be shown first, even if they were not first in the source model
- Attribute domain and entity order is alphabetical in the CSV
- Relationship order is by entity name (alphabetical) and according to their order in the entity
Guidelines for importing a Compose model
Note the following:
- For boolean fields, accepted values are True/False
- Column order has no meaning; only column names, which are case insensitive, unless defined differently
- If the entities.csv file is missing, the entities can be inferred from the attributes.csv file (with no description). In such cases, duplicate objects are verified to be the same and added only once. For example, if there are several rows with entity name myEntity, the entity will only be added once
- Data type is the Compose logical type
- Relationship details override the underlying attributes information (e.g. history type, is key, etc.)
-
When importing the attributes.csv file, a new entity will not be created if wasn’t already created in the entities.csv file, and its attributes all have relationships to other entities. In such cases, you should create the entity manually or add it to the entities.csv file
-
When importing the relationships.csv file, existing attributes will be replaced if:
child attribute prefix+attribute name = relationship_prefix+parent_attribute_name_prefix+parent_attribute_name
- ID is the name of the attribute in the parent entity and
- Customer is the prefix of the relationship and
- Designated is the prefix of the parent attribute.
For example, the attribute named CustomerDesignatedID will be replaced by the relationship where:
Note that attributes marked as relationships will be skipped when imported from attributes.csv as they must derive their data type from the Attributes Domain.
Entities CSV file format
Column Name | Required | If column/value is missing | Comments |
---|---|---|---|
Entity Name |
Yes |
Reject |
Case insensitive |
Entity Description |
No |
Empty |
- |
Attributes CSV file format
If Attribute Domain is missing in the attributes.csv file, there must be a data type. Attribute domains that differ but have the same name will be appended with the suffix _01.
Column Name | Required | If column is missing | If value is missing | Comments |
---|---|---|---|---|
Entity Name | Yes |
Reject |
Reject |
Case insensitive |
Attribute Name | Yes |
Reject |
Reject |
Case insensitive |
Description | No |
Empty |
Accept |
- |
Is Key | No |
No attributes will be defined as keys. In such a case, validation will fail as at least one key needs to be defined. |
No Key |
On import, Compose does not validate that each entity has at least one key attribute (required). If you import entities without key attributes, then you must define a key attribute in Compose after importing the entity. Otherwise, Model validation will fail. |
Attribute Domain | No |
If it is missing, Data Type must exist and attribute domains will be built or used the same as they are during discovery. |
Reject | The Attribute Domain name or the word "Relationship" |
Data Type | No |
If it is missing, the Attribute Domain must exist. An error will be returned if the data type does not match the attribute domain or if both exist. |
Reject |
Use combined syntax: Varchar(50) Decimal(10,2) |
Prefix | No |
Empty |
Accept (an empty feld means there will be no prefix) |
- |
History Type | No |
Key - Type 1, Not key - type 2 |
Reject |
Values are Type 1 or Type 2. Yes (Type 2) and No (Type 1) are also allowed. |
Satellite/Hub | No |
Key is Hub; other attributes are SAT 1 |
Reject |
Hub/1/2/3 |
Expression |
No |
No expressions in any attribute |
No expression in any attribute |
- |
Expresssion Params |
No |
All attribute-parameter mappings are trivial (same name) |
All attribute-parameter mappings are trivial (same name) |
- |
Add after | No | Not relevant. | Not relevant. |
Instructs Compose to add the attribute after a specific attribute. The column is only relevant when adding attributes. When the column is empty, the corresponding attributes should be added at the end (according to their order in the CSV file). Note that it may refer to any attribute that is defined above the current row. For example, assuming a record contains the attributes address, height, and weight, specifying the following: school, add after=weight ID, add after=school email, add after=empty Will result in the following order: address, height, weight, school, ID, email |
Attributes Domain CSV file format
Column Name | Required | If column is missing | If value is missing | Comments |
---|---|---|---|---|
Name | Yes |
Reject |
Reject |
Case insensitive |
Description | No |
Empty |
The specific attribute value may be empty as well. |
- |
Data Type |
No |
Reject |
Reject |
Use combined syntax: Varchar(50) Decimal(10,2) |
Relationships
Column Name | Required | If column is missing | If value is missing | Comments |
---|---|---|---|---|
Child Entity | Yes | Reject | Reject | This is the more detailed entity (e.g. OrderDetails). Case insensitive. |
Parent Entity | Yes | Reject | Reject | This is the less detailed entity (e.g. Products). Case insensitive. |
Prefix | No |
Empty If there are several relationships from the same source to the same target, a prefix must be added. |
If all the originating attributes have the same prefix, use it here. A relationship may not have a prefix to its underlying attributes. The specific attribute value may be empty as well. |
- |
Position After | No |
Add the relationships to the end. Relationships are ordered according to their order in the file. |
Same as missing column |
The attribute name or relationship to position it after or ”0” to position it first. |
Description | No |
Empty |
Specific attribute may have empty value as well |
- |
Is Key | No |
No attributes will be defined as keys. In such a case, validation will fail as at least one key needs to be defined. |
No key |
- |
History Type | No |
Key: Type 1 Non-key: Type 2 |
Reject |
Values are Type 1 or Type 2. Yes (Type 2) and No (Type 1) are also allowed. |
Satellite/Hub | No |
Key: Hub Other attributes: SAT 1 |
Reject | Hub/1/2/3 |