Data Migration
The purpose of Data Migration CLI command is to perform model data (TQL) from given source storage to destination storage.
Usage: This section explains the usage of TQL CLI Data Migration Options
Please refer to Environment Variable section before starting to use the command tool.
Data Migration Design
Data Migration can occur at two levels - Storage-level or Raw Copy or Model-level migration.
- Storage-level or Raw Copy - Data Migration can occur at two levels - Storage-level or Raw Copy. The data migration at storage level involves copying the raw copy of the database table.
- Model-level Migration - At Model-level the data is read from source system and then created into destination system.
Storage-level Migration
TQL CLI Storage-level migration
$ bin/tql -datamigrate -level storage
Model-level Migration
TQL CLI Model-Level Migration
$ bin/tql -datamigrate -level model
Model-level Migration is facilitated using Model Mapping XML file.
Models (to-be-copied) Description XML File
Model Mapping File
<ModelMapping> <Model> <QName> Atomiton.Sensors.TempSensor </QName> <FindCondition> </FindCondition> <SourceFacetId> </SourceFacetId> <DestinationFacetId> </DestinationFacetId> <MappingFile> ./resources/applicationupgrade/spaces/TempSensorMappingFile.xml </MappingFile> <PathToElement> </PathToElement> <PageSize> </PageSize> <DeleteInstancesBeforeCreate> </DeleteInstancesBeforeCreate> </Model> <Model> .. </Model> </ModelMapping>
Model Attributes Mapping XML File Parmeters
Parent Element | Sub Element Name | Descrption |
---|---|---|
Model | QName | Full qualified Name of the Model to the copied to desitnation. |
FindCondiiton | Find Condition Statement to pull data from the source system | |
SourceFacetId | Source system EndPoint Facet ID to Read the Model | |
DestinationFacetId | Destination system EndPoint Facet ID to Copy the Model to | |
MappingFile | Describe the attrbiutes mapping from source to destination | |
PathToElement | Xpath to reach to the Element within the model from the result | |
PageSize | Batch size read data from source | |
DeleteInstancesBeforeCreate | Boolean flag to designate if destination data need to be deleted before creating / loading a new one |
Example
Sample Model Description XML File
<ModelMapping> <Model> <QName> Atomiton.Sensors.TempSensor </QName> <FindCondition> <sensorId> <ne> </ne> </sensorId> </FindCondition> <SourceFacetId> L3QOX2AXAAAAUZ2FBTJI6MOZ </SourceFacetId> <DestinationFacetId> L3QOX2AXAAAAUZ2FBTJI6MOZ </DestinationFacetId> <MappingFile> ./resources/applicationupgrade/spaces/TempSensorMappingFile.xml </MappingFile> <PathToElement> /Find/Result/TempSensor </PathToElement> <PageSize> 10 </PageSize> <DeleteInstancesBeforeCreate> true </DeleteInstancesBeforeCreate> </Model> <Model> <QName> Atomiton.Sensors.VendorInfo </QName> <FindCondition> <Sid> <ne> </ne> </Sid> </FindCondition> <SourceFacetId> L3QOX2AXAAAAUZ2FBTJI6MOZ </SourceFacetId> <DestinationFacetId> L3QOX2AXAAAAUZ2FBTJI6MOZ </DestinationFacetId> <MappingFile> ./resources/applicationupgrade/spaces/VendorInfoMappingFile.xml </MappingFile> <PathToElement> /Find/Result/VendorInfo </PathToElement> <PageSize> 10 </PageSize> <DeleteInstancesBeforeCreate> true </DeleteInstancesBeforeCreate> </Model> </ModelMapping>
.