The Model Loader
Introduction
The Model Loader can be used to import data models between Cinchy instances. For example, if you have a DEV environment and make a change to a table design (ex: changing a column name), you can export and deploy your data model to a PROD environment and Cinchy will intelligently consolidate and merge the schema changes to adhere to the latest version.
The Model Loader does not import the actual data, just the model (ex: table column names, views, filters, etc.)
To import more than one data model, or to import it together with things such as queries, reference data, etc., use the Cinchy DXD tool.
Ensure that the import environment has access to any applicable reference data (such as that needed for linked columns).
Prerequisites
To successfully run the model loader you need to ensure that:
- You have the “Can Design Tables” permission checked within the [Cinchy].[Users] table.
- You have the “Design Table” permission checked within the Data Controls tab of your table.
- You have the “Insert Rows” permission checked within the Data Controls tab of the [Cinchy].[Models] table. Note that each time you import a model (a new or updated one) a new row will populate in this table.
Using the Model Loader
- Export your data model: navigate to the table you want to export and click Design Table > Export. Choose whether to export as an XML or a JSON file.
- In the environment that you want to import into, navigate to the Model Loader by using the /apps/modelloader endpoint. For example: Cinchy.com/apps/modelloader
- Configure your settings. By default, the following are enabled:
- Drop Columns: tell Cinchy to drop columns in the import environment table if they have been removed from the model.
- Update Column Information: tell Cinchy to update column information (name, description, etc.) in the import environment table if they have been changed in the model.
- Rename Tables and Create/Update Domain Assignments: tell Cinchy to rename tables or domains in the import environment table if they have been changed in the model.
- Recalculate all existing values in changed calculated column formulas: tell Cinchy to update any existing calculated column data values in the import environment table if the formula changed within the model.
- Select Choose File and upload the XML/JSON file that you exported in step 1. Click Submit; the page should refresh with a "success" message.
- You can validate a successful model load by navigating to the imported table, or by finding it in the [Cinchy].[Models] system table.
Updating an Imported Model
After the initial model load, when you make changes to a data model (such as adding or renaming a column) and want to import an updated version into your environment you must change the version number prior to importing.
- Export your updated data model as per usual.
- Open the exported XML/JSON file.
- Under the data model info, update the version code. For instance, from version="1.0.0" to version="1.1.0"
- Save your updated XML/JSON file. You can then import it as per usual. Since this is a new model version, it will create a new row in the [Cinchy].[Models] table.
Cloning a Table
To clone a Cinchy table you must first clone the model, then clone the data:
- Navigate to the relevant table > Design Table > Export > XML.
- In an XML editor, open the exported model and:
- Change the name of the model,
- Change the name of the table,
- Remove the GUIDs from the table.
- Save the XML.
- Use the model loader to upload the modified XML.
- Navigate back to your original table > Manage Data > Export.
- Import the data into your new table.