function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
stephanie_zstephanie_z 

How to escape a string in the query passed to data loader command line tool

Hi,

 

I am using the data loader command line tool to extract data out. For one object, I only want to extract data that meets certain criteria. How do I specifiy a string value in the sfdc.entity field? 

 

$JAVA_HOME/jre/bin/java -cp $FILE_BASEDIR/DataLoader.jar \
-Djava.io.tmpdir=$LOGDIR -Dsalesforce.config.dir=$FILE_BASEDIR/config \
com.salesforce.dataloader.process.ProcessRunner process.name=extract \
process.lastRunOutputDirectory=$LOGDIR \
process.statusOutputDirectory=$LOGDIR \
dataAccess.name=$DATADIR/$STAMPFOLDER/57_Standard_kav_01.csv \
sfdc.entity=Standard__kav \
sfdc.extractionSOQL="select ID,Title,Summary from Standard__kav where PublishStatus=\'Online\'"

 

I am gettingan empty query error

 

2012-02-14 15:38:54,306 ERROR [extract] action.ExtractAction getColumnsFromSoql (ExtractAction.java:235) - Error in query: query is empty
2012-02-14 15:38:54,307 ERROR [extract] progress.NihilistProgressAdapter doneError (NihilistProgressAdapter.java:51) - Error in query: query is empty

I was able to extract data with the same set up for those that don';t have the where clause.

 

Does anyone know how to escape the string value in the where clause?

kiranmutturukiranmutturu

query empty error will generally come if the respective column values are null for the records....

stephanie_zstephanie_z

I supply the query as an argument in the command line since I need to query by different timestamp, e.g.

 

sfdc.extractionSOQL="Select Id, KnowledgeArticleId, OwnerId, IsDeleted, PublishStatus, CreatedDate, CreatedById, LastModifiedDate, LastModifiedById,SystemModstamp,IsMasterLanguage, Language, Title, Summary, ArticleNumber, FirstPublishedDate, LastPublishedDate, IsOutOfDate, MasterVersionId, Allow_Votes__c, Answer_Type__c, Keywords__c, Language__c, Locale__c, Need_Translation__c, Play_Button__c FROM Standard__kav WHERE PublishStatus='Online' and Language='en_US' and ((SystemModstamp < 2012-02-14T13:42:51.000z and SystemModstamp > 2011-02-17T00:51:21.000Z) or SystemModstamp In (2012-02-14T13:42:51.000z)) "

 

I read somewhere that there is a BUG in the Data Loader CLI that does not permit a "=" in the query or it will not
override the query in the "./config/process-conf.xml" when the object extraction begins. All queries that normally use an "=" in the where clause must be modified to use the "in" keyword instead.

 

However, Standard__kav object is kind of special and require us to supply "PublishStatus=..." in the WHERE clause. Is there anyway to have "=" in sfdc.extractionSOQL argument? I tried to use escape it with \ and it didn't seem to work. 

 

 

Ed SFDCDeveloperEd SFDCDeveloper
Was there ever a resolution to this? I also want to dynamically pass in a date to a Where clause in process.bat or to dataloader.jar.  If this isn't possible, then I think I'll just update process-conf.xml file to change the sfdc.extractionSOQL parameter in the conf file itself.  Thoughts?