Salesforce translator - foreign tables does not support query
statements by default
-----------------------------------------------------------------------------------
Key: TEIID-4461
URL:
https://issues.jboss.org/browse/TEIID-4461
Project: Teiid
Issue Type: Quality Risk
Components: Salesforce Connector
Reporter: Juraj DurĂ¡ni
Assignee: Steven Hawkins
Priority: Minor
Fix For: 9.1
If salesforce objects are modeled in VDB using DDL metadata (CREATE FOREIGN TABLE...),
user cannot select data from them by default. See VDB \[1\], RA definition \[2\] and
exception \[3\].
*SELECT * FROM sfSourceProp.Pricebook2* -> OK
*SELECT * FROM sfSourceNative.Pricebook2* -> OK
*SELECT * FROM sfSource.Pricebook2* ->fail \[3\]
{code:xml|title=\[1\] VDB}
<vdb name="salesforce-test" version="1">
<model name="sfSourceNative" type="PHYSICAL">
<source name="sfnative" translator-name="salesforce-34"
connection-jndi-name="java:/salesforce"/>
<metadata type="NATIVE"/>
</model>
<model name="sfSource" type="PHYSICAL">
<source name="sf" translator-name="salesforce-34"
connection-jndi-name="java:/salesforce"/>
<metadata type="DDL"><![CDATA[CREATE FOREIGN TABLE Pricebook2
(Id string, Name string, IsActive boolean, IsStandard boolean, Description string,
IsDeleted boolean) OPTIONS (UPDATABLE 'TRUE');]]>
</metadata>
</model>
<model name="sfSourceProp" type="PHYSICAL">
<source name="sfprop" translator-name="salesforce-34"
connection-jndi-name="java:/salesforce"/>
<metadata type="DDL"><![CDATA[CREATE FOREIGN TABLE Pricebook2
(Id string, Name string, IsActive boolean, IsStandard boolean, Description string,
IsDeleted boolean) OPTIONS (UPDATABLE 'TRUE',
"{http://www.teiid.org/translator/salesforce/2012}Supports Query"
'TRUE');]]>
</metadata>
</model>
</vdb>
{code}
{code:xml|title=\[2\] Resource adapter}
<resource-adapter id="salesforce-ds">
<module slot="main"
id="org.jboss.teiid.resource-adapter.salesforce-34"/>
<transaction-support>NoTransaction</transaction-support>
<connection-definitions>
<connection-definition
class-name="org.teiid.resource.adapter.salesforce.SalesForceManagedConnectionFactory"
jndi-name="java:/salesforce" enabled="true"
use-java-context="true" pool-name="salesforce-ds">
<config-property name="password">
secretplustoken
</config-property>
<config-property name="URL">
https://www.salesforce.com/services/Soap/u/34.0
</config-property>
<config-property name="username">
user(a)example.com
</config-property>
</connection-definition>
</connection-definitions>
</resource-adapter>
{code}
{code:plain|title=\[3\] Exception}
12:33:22,178 WARN [org.teiid.PROCESSOR] (Worker6_QueryProcessorQueue85) TEIID30020
Processing exception for request EmUpFy4HxjNz.0 'TEIID30504 sf: Pricebook2 does not
support the query statement.'. Originally TeiidProcessingException
SelectVisitor.java:129.: org.teiid.core.TeiidProcessingException: TEIID30504 sf:
Pricebook2 does not support the query statement.
at
org.teiid.dqp.internal.process.DataTierTupleSource.exceptionOccurred(DataTierTupleSource.java:401)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.dqp.internal.process.DataTierTupleSource.nextTuple(DataTierTupleSource.java:161)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.query.processor.relational.AccessNode.nextBatchDirect(AccessNode.java:391)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:282)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:145)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:151)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:114)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:164)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:146)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:472)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:348)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:274)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:276)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[rt.jar:1.8.0-internal]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[rt.jar:1.8.0-internal]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.8.0-internal]
Caused by: org.teiid.translator.TranslatorException: Pricebook2 does not support the
query statement.
at
org.teiid.translator.salesforce.execution.visitors.SelectVisitor.visit(SelectVisitor.java:129)
at org.teiid.language.NamedTable.acceptVisitor(NamedTable.java:66)
[teiid-api-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.language.visitor.AbstractLanguageVisitor.visitNode(AbstractLanguageVisitor.java:51)
[teiid-api-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.language.visitor.AbstractLanguageVisitor.visitNodes(AbstractLanguageVisitor.java:63)
[teiid-api-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.translator.salesforce.execution.visitors.SelectVisitor.visit(SelectVisitor.java:58)
at org.teiid.language.Select.acceptVisitor(Select.java:110)
[teiid-api-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.language.visitor.AbstractLanguageVisitor.visitNode(AbstractLanguageVisitor.java:51)
[teiid-api-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.translator.salesforce.execution.QueryExecutionImpl.execute(QueryExecutionImpl.java:138)
at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:364)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source) [:1.8.0-internal]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[rt.jar:1.8.0-internal]
at java.lang.reflect.Method.invoke(Method.java:483) [rt.jar:1.8.0-internal]
at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:211)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at com.sun.proxy.$Proxy48.execute(Unknown Source)
at
org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:306)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:112)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at
org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:108)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0-internal]
at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:65)
[teiid-engine-8.12.5.redhat-8.jar:8.12.5.redhat-8]
... 6 more
{code}