-
1. Re: Execute connector methods directly
shawkins Sep 26, 2016 2:41 PM (in response to tomesc)Connections are not required for a translator. This can be declared by calling setSourceRequired(false) in the translator constructor.
If you functions are static, then more than likely they should added as UDFs and not tied to a particular translator. Are you trying to expose functions or stored procedures?
-
2. Re: Execute connector methods directly
tomesc Sep 27, 2016 4:33 AM (in response to shawkins)Steven, thank you for your prompt reply. Maybe I should have expressed myself more clearly. I do not want to execute a SQL function or procedure. Instead I want to use a method that is defined in the connector (the implementation class of BasicConnection), or in my case SalesforceConnectionImpl. The Salesforce API provide a "upsert()" method (combination of insert/update) which is very useful in some circumstances (especially in cloud computing). So my intention is to extend the Salesforce connector with an "upsert" method and call that method directly. I thought of something like that:
Context ctx = new InitialContext();
org.teiid.resource.spi.WrappedConnectionFactory wrapper = ctx.lookup("java:/salesforceDS"); // jndi-name of resource adapter connection
Connection con = wrapper.getConnection();
... and so on.
But I have no idea how to cast it to the SalesforceConnectionImpl class to reach the methods. Or is there an error in my reasoning? Since I am new in TEIID I don't know if that all is possible using UDF's.
Thomas
-
3. Re: Execute connector methods directly
shawkins Sep 28, 2016 5:15 PM (in response to tomesc)There is an existing issue: [TEIID-3630] Support merge statement pushdown - JBoss Issue Tracker that would allow Teiid to pushdown a merge statement directly. That is probably the preferred solution.
To do this on your own you have to fork / extend the SalesforceConnection / SalesforceConnectionImpl to expose the upsert call, then utilize that in an extended translator - which would initially only work through the direct query procedure.
Can you add a subtask to TEIID-3630 specifically for Salesforce?
-
4. Re: Execute connector methods directly
tomesc Sep 29, 2016 10:26 AM (in response to shawkins)Thanks Steven, I created the subtask [TEIID-4481] Support for the upsert statement which is provided by Salesforce API - JBoss Issue Tracker .
-
5. Re: Execute connector methods directly
shawkins Sep 30, 2016 8:47 AM (in response to tomesc)Thanks. We should be able to get this into 9.2.