Thursday, June 12, 2014

Data Loader Override FullImage, Thumbnail scenario fix or any other columns exclusion

This blog explain a scenario where  FULLIMAGE and THUMBNAIL are overridden in table CATGRPDESC even when the CSV files is not passing the values for these fields.
This can be used to apply column level exclusions for any other component similarly so these fields are not overridden.


C:\IBM\WCDE_ENT70\workspace\WC\xml\config\com.ibm.commerce.catalog\dataload\wc-loader-catalog-group.xml

Pasting a block where the change is required..this XML has much more business object configurations:
 <_config:DataLoader className="com.ibm.commerce.foundation.dataload.BusinessObjectLoader">
  <_config:ColumnExclusionList>   
    <_config:table name="CATGRPDESC" columns="FULLIMAGE,THUMBNAIL" />
  </_config:ColumnExclusionList>  
    <_config:DataReader className="com.ibm.commerce.foundation.dataload.datareader.CSVReader" firstLineIsHeader="true" useHeaderAsColumnName="true" />
......
......
.....

Sample RunProductLoad.bat for testing, make sure the path for wc-dataload-catalog-group.xml is correctly done as it is pointing to relative below:

@echo off
setlocal
cd "C:\IBM\WCDE_ENT70\bin"
call dataload ..\workspace\DataLoad\dataload\CustomDataLoad\MasterCatalog\wc-dataload-catalog-group.xml -DXmlValidation="false" -DComponent=CustomDataLoad\MasterCatalog -DFeedHome=C:\IBM\WCDE_ENT70\workspace\DataLoad\dataload -DWCConfigHome=C:\IBM\WCDE_ENT70\workspace\WC\xml\config -DCVConfigHome=C:\IBM\WCDE_ENT70\workspace\DataLoad\dataload\Config
endlocal


Sample CSV file: CatalogGroup.csv, GroupIdentifier points to CATGROUP.IDENTIFIER and ParentGroupIdentifier is the parent from CATGRPREL

Start date 2013-01-28 16:40:42 
GroupIdentifier,ParentGroupIdentifier,TopGroup,Sequence,Name,ShortDescription,Published
36010,310010,FALSE,0,Sample & Decors,Sample & Decors,1

If you have spaces before of GroupIdentifier or ParentGroupIdentifier: It causes this issue below:

Exception message:
The ID was not resolved for the table CATGROUP with the unique index data [  310010, 7000000000000000051].
Stack trace:
com.ibm.commerce.foundation.dataload.exception.DataLoadApplicationException: The ID was not resolved for the table CATGROUP with the unique index data [  310010, 7000000000000000051].
at com.ibm.commerce.foundation.dataload.idresolve.IDResolverForOneTable.resolveId(IDResolverForOneTable.java:339)
at com.ibm.commerce.foundation.dataload.idresolve.IDResolverImpl.resolveId(IDResolverImpl.java:369)
at com.ibm.commerce.foundation.dataload.util.DataLoadHelper.resolveIds(DataLoadHelper.java:2818)

Success or failure: logs folder in toolkit: Sample success log

Load summary for load item: CatalogGroup.
----------------------------------------------------------------------------------
Business Object Configuration: C:\IBM\WCDE_ENT70\workspace\WC\xml\config/com.ibm.commerce.catalog/dataload/wc-loader-catalog-group.xml
Data loader mode: Replace.
Batch size: 1.
Commit count: 100.
Error Tolerance Level: 1.
Error Count: 0.
Amount of data processed: 3.
Amount of business objects processed: 1.
Amount of business objects committed: 1.
Data loader initialization time: 1 seconds.
Data loader completed in 4.236 seconds.
Total flush time: 0 seconds.
Total commit time: 0.002 seconds.
CSV file location: C:\IBM\WCDE_ENT70\bin\..\workspace\DataLoad\dataload\CustomDataLoad\MasterCatalog\CatalogGroup.csv.
Affected tables (6):
Table name: CATGROUP, Affected number of rows: 1.
Table name: STORECGRP, Affected number of rows: 1.
Table name: CATGRPDESC, Affected number of rows: 1.
Table name: CATTOGRP, Affected number of rows: 0.
Table name: CATGRPREL, Affected number of rows: 1.
Table name: TI_DELTA_CATGROUP, Affected number of rows: 1.

2 comments:

  1. Great post!!
    A lot of useful tips to keep in mind!
    Thanks!

    ReplyDelete
  2. Me encanta el articulo, es super interesante y curioso, se lee genial con mucha fluidez. Estoy deseando leer más artículos vuestros, sois geniales.

    ReplyDelete