Importing Data
Importing Data
Importing Data Using Maven
The Import-Export tool provides a maven profile, do-import, to import data easily. Importing using the maven command is preferable in a local development environment. The maven profile allows for debugging of the Import-Export tool using mvnDebug and the creation of environment specific importconfiguration.xml files if needed. When using the maven profile, there is no need to specify database connection details.
To import data via maven, use the following command from the target directory:
mvn package -Pdo-import
Optionally, you can specify a directory to retrieve the exported data from using the data.location flag:
mvn package -Pdo-import -Ddata.location=./exported-data
Where ./exported-data is the directory containing exported data. The directory should be specified as relative (i.e., using ./../) to the target directory.
Importing Data Using the Batch Script
importexport.bat -i -c <import_config_file> [-g <change_set_guid> [-s {stage1|stage2}]]
where:
- <import_config_file> is the path to the file that contains the import configuration
- <change_set_guid> is the GUID of the Change Set into which you want to import the data
During the import operation, information and error messages are printed to the console. Errors are also logged in a file in the logs directory.
If you experience problems during import, see Appendix E - Troubleshooting.
Importing Data into a Change Set
You can import data directly into a Change Set. To do this, you must include the -g command line option and specify the GUID of the target Change Set.
Importing data into a Change Set is a two-stage process. In the first stage, the target system verifies that the data can be imported into the Change Set. (It verifies that a Change Set with the specified GUID exists, that it is in the open state, and that the objects you are importing are not already in another Change Set.) If all requirements are met, the objects are added to the Change Set.
In the second stage, the data is imported into system.
You can include the -s option if you want to control execution of the import. The -s option has two possible values:
- stage1, which only adds the objects to the list of objects in the Change Set without actually importing them. This option is useful if you want to prevent objects from being added to other Change Sets while you continue to make changes.
- stage2, which only imports the data. This may only be used if the objects have already been added to the Change Set, either using the stage1 option or through the Commerce Manager.
If you do not specify the -s option, both stage 1 and stage 2 are performed.
If an object was only added to the Change Set (only stage 1 was executed), it will appear in the list of objects when viewing the Change Set in the Commerce Manager. However, if you try to launch the editor for that object, it will not open because the object does not exist in the system. The stage 2 must be executed in order to import the object into the target system.