0

Is it possible to push down comments to the source database query?

Given example Teiid query:

select /* 'request_id' */ columnA, sum(columnB)
from tableA

I'd like to see the comment pushed down to the source database so that I can capture the request_id in the logs. I've looked at source hints, but have not had any luck getting those pushed down to the source query either.

user1359256
  • 15
  • 1
  • 4

1 Answers1

0

See http://teiid.github.io/teiid-documents/master/content/reference/JDBC_Translators.html and search for UseCommentsInSourceQuery

Ramesh Reddy
  • 554
  • 1
  • 3
  • 8
  • Could you provide an example of where this is set? I've tried many things and still can't get it to work. – user1359256 Apr 18 '20 at 18:56
  • ` ` if you are using the XML based VDB, a DDL based VDB will be represented little differently – Ramesh Reddy Apr 19 '20 at 14:25
  • This didn't work: `/sources/detail/Tbl.ddl/views/Vw.ddl` But I am also looking to pass custom comment to source. It gets stripped. – user1359256 Apr 20 '20 at 13:42
  • I believe custom comments can be only be sent on DirectQueryExecutions as there is no place to define this on a View transformation. Of course, you can extend the translator also to add custom ones. We have done this for Oracle as shown here https://github.com/teiid/teiid/blob/master/connectors/jdbc/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java#L598-L610, unfortunately, this comment style does not apply to all, if you think certain format applies to Impla open a JIRA we can fix it – Ramesh Reddy Apr 20 '20 at 18:39
  • Thanks, Ramesh! I will give it a try. – user1359256 Apr 20 '20 at 20:56