Soql query not handling apostrophes

asked 2021-04-16 12:09:02 -0500

tclaw46 gravatar image

I am attempting to extract data using a soql query with the salesforce lookup stage. I am using Streamsets version 3.21.0. I am using one of the fields from the batch records to filter the data I want to add to each record. I am running into a problem where the pipeline is throwing an error whenever the value from said field has an apostrophe in it. It looks like this:

select Id from <custom salesforce="" object=""> where Name = 'Moody's''

I tried using backward slash to escape the apostrophe e.g. select Id from <custom salesforce="" object=""> where Name = 'Moody\'s', but continue to get this error:

com.streamsets.pipeline.api.StageException: FORCE_27 - Error parsing SOQL query: select * from <custom salesforce="" object=""> where Name = 'Moody\'s' at com.streamsets.pipeline.lib.salesforce.ForceUtils.getSobjectTypeFromQuery(ForceUtils.java:134) at com.streamsets.pipeline.stage.origin.salesforce.ForceSource.init(ForceSource.java:270) at com.streamsets.pipeline.api.base.BaseStage.init(BaseStage.java:48) at com.streamsets.pipeline.api.base.configurablestage.DStage.init(DStage.java:36) at com.streamsets.datacollector.runner.StageRuntime.lambda$init$0(StageRuntime.java:220) at com.streamsets.datacollector.util.LambdaUtil.withClassLoaderInternal(LambdaUtil.java:148) at com.streamsets.datacollector.util.LambdaUtil.withClassLoader(LambdaUtil.java:44) at com.streamsets.datacollector.runner.StageRuntime.init(StageRuntime.java:218) at com.streamsets.datacollector.runner.StagePipe.init(StagePipe.java:109) at com.streamsets.datacollector.runner.StagePipe.init(StagePipe.java:44) at com.streamsets.datacollector.runner.Pipeline.initPipe(Pipeline.java:411) at com.streamsets.datacollector.runner.Pipeline.init(Pipeline.java:314) at com.streamsets.datacollector.runner.preview.PreviewPipeline.run(PreviewPipeline.java:49) at com.streamsets.datacollector.execution.preview.sync.SyncPreviewer.start(SyncPreviewer.java:238) at com.streamsets.datacollector.execution.preview.async.AsyncPreviewer.lambda$start$1(AsyncPreviewer.java:105) at com.streamsets.pipeline.lib.executor.SafeScheduledExecutorService$SafeCallable.lambda$call$0(SafeScheduledExecutorService.java:226) at com.streamsets.datacollector.security.GroupsInScope.execute(GroupsInScope.java:34) at com.streamsets.pipeline.lib.executor.SafeScheduledExecutorService$SafeCallable.call(SafeScheduledExecutorService.java:222) at com.streamsets.pipeline.lib.executor.SafeScheduledExecutorService$SafeCallable.lambda$call$0(SafeScheduledExecutorService.java:226) at com.streamsets.datacollector.security.GroupsInScope.execute(GroupsInScope.java:34) at com.streamsets.pipeline.lib.executor.SafeScheduledExecutorService$SafeCallable.call(SafeScheduledExecutorService.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at com.streamsets.datacollector.metrics.MetricSafeScheduledExecutorService$MetricsTask.run(MetricSafeScheduledExecutorService.java:100) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: org.antlr.v4.runtime.misc.ParseCancellationException at org.antlr.v4.runtime.BailErrorStrategy.recoverInline(BailErrorStrategy.java:90) at org.antlr.v4.runtime.Parser.match(Parser.java:227) at soql.SOQLParser.statement(SOQLParser.java:524) at com.streamsets.pipeline.lib.salesforce.ForceUtils.getStatementContext(ForceUtils.java:143) at com.streamsets.pipeline.lib.salesforce.ForceUtils.getSobjectTypeFromQuery(ForceUtils.java:129) ... 27 more Caused by: org.antlr.v4.runtime.InputMismatchException ... (more)

edit retag flag offensive close merge delete