Extracting Commerce Composer data with the Data Extract utility

We can configure and run the Data Extract utility from a command-line utility to extract Commerce Composer data for a store into CSV output files. We can then use the Data Load utility to load the extracted data into stores in other environments, such as for testing purposes. By using these utilities to copy data between instances, business users do not need to manually create the same assets across multiple instances.


Before beginning

Ensure that you complete the following tasks:

Note: If you plan to load the extracted data into another instance, the store to load data into must have the Commerce Composer tool enabled.


Task info

When we are configuring the Data Extract utility to extract Commerce Composer data, we can extract data for the following types of Commerce Composer objects:

Sample configuration files are provided for you to edit and use to quickly configure the utility. The sample configuration files are in the following directory:

These sample files configure the Data Extract utility to extract data into CSV output files. The output files are compatible with the Data Load utility for use as input files. If needed, we can edit the other sample configuration files to change how the utility retrieves, transforms, and outputs data. For more information about the sample configuration files and the data that the files are configured to extract for each object type, see Sample: Extracting Commerce Composer data. Notes:


Procedure

  1. Configure the Data Extract utility. When we are configuring the utility, copy the sample configuration files and directories to another local directory. Edit and use your copy of the sample configuration files. These sample files are in the following directory and subdirectories:

    There is a separate data extract order configuration file (wc-dataextract-business-object.xml) for each type of Commerce Composer object:

    • For layouts, use the wc-dataextract-layout.xml configuration file.

    • For layout templates, use the wc-dataextract-template.xml configuration file.

    • For widgets, use the wc-dataextract-widget.xml configuration file.

    • For pages, use the wc-dataextract-page.xml configuration file.

  2. Run the Data Extract utility to extract the data for the Commerce Composer object for the configured store.

    1. Open a command-line utility and go to the appropriate directory:

    2. Enter the following command to run the sample data order file and extract the information.

      • (Linux) ./dataextract.sh ../samples/DataExtract/CommerceComposer/wc-dataextract-object.xml

      • (Developer) dataextract ..\samples\DataExtract\CommerceComposer\wc-dataextract-object.xml

      When the utility completes the extraction process, the utility generates the output files for the object within the data output location that you configured in the data extract order configuration file.

      We can configure the utility by including optional parameters in the command. For more information about the available parameters, see Data Extract utility

  3. Verify that all of output files are successfully generated.

    1. Go to the data output location and open each of the generated output files for the object and review the file contents. By default, these files are generated in the following directory and subdirectories:

      Within each output CSV file, the first row of the file includes the column headings. Each subsequent row includes the data for a single extracted object. The columns within the file are the same as the files that are needed to load the object data with the Data Load utility.

      Note: If we created our own configuration files, ensure that your output files are configured to include the correct case-sensitive column names and corresponding values. For instance, LanguageId cannot be languageId in your output file. If your file does not include the correct case-sensitive column names, the Data Load utility might not load successfully. For more information about the column names and data that can be in each output file, see Commerce Composer object input file definitions.

    2. Compare the contents of the file with the data in the source database tables to verify that the correct data is extracted.


What to do next

We can use the generated output files as input files with the Data Load utility to load the data into another WebSphere Commerce store or instance to quickly create or replace Commerce Composer objects in the other stores or instances. For example, to set up multiple testing environments that include the same data, such as for testing the display of new layouts or widget functionality on the storefront. We can also load the data to copy objects between stores or instances when business users need to include those objects on store pages in the target stores or instances. By extracting and loading Commerce Composer objects, developers and business users do not need to re-create the objects with the Commerce Composer tool in each store or instance. After you load your extracted data into a new environment, the objects become available in the Commerce Composer tool for the specified store.Notes:

Tip: When you finish loading your extracted data, back up the file before your run another extract operation for the same type of object. You might need the older file if you need to delete or reload the data that you previously loaded. When you run an extract for the same object type, the Data Extract utility overwrites the content of the output file if the file name and directory location remain unchanged.

For samples that demonstrate how to load data for each type of Commerce Composer object, see Commerce Composer samples. When you follow these samples, edit the load order configuration files to configure the Data Load utility to load the files that were generated by the Data Extract utility.


Related concepts
Overview of the Data Extract utility