2 Replies Latest reply on Jun 20, 2013 8:27 AM by pinkstondevin

    file - delegating translator

    pinkstondevin

      If I have a flat file (txt) file, which I create a view off of, but want to use the same delegating translator I use with Hadoop/Oracle/Postgres should it work in theory?

       

      Basically I override the createexcecution method in my delegator, and it works perfectly with the other sources.  However with flat files, it seems to not enter the delegating translator.  Do I need to create a virtual procedure since I creat a view (texttable) off of the txt file?

       

      My flat file source:

      <model name="fileCleaner">

       

              <source name="text-connector" translator-name="file-delegator" connection-jndi-name="java:/cleaner-file"/>

       

          </model>

       

      <model visible = "true" type = "VIRTUAL" name = "weatherstats">

              <metadata type = "DDL"><![CDATA[ 

                  CREATE VIEW cleanFile (

                  nyOne varchar(40),

                  nyTwo varchar(40),

                  nyThree varchar(40),

                  nyFour varchar(40)

                  ) AS

                  select cleanFile.* from (call fileCleaner.getTextFiles('newyork.txt')) f, TEXTTABLE(f.file COLUMNS nyOne varchar(40), nyTwo varchar(40), nyThree varchar(40), nyFour varchar(40)HEADER) cleanFile;

                  ]]>

              </metadata>

          </model>

       

      So i query "select * from cleanFile", i am returning results, but my delegating translator is not modifying the results as it does with other data sources.

       

      Thanks!

        • 1. Re: file - delegating translator
          rareddy

          Devin,

           

          In the case of file translator, Teiid is executing a "procedure" called "getTextFiles", that returns CLOB. So if you want intercept you can intercept that procedure call and return an another CLOB. The view layer in not at translator level, so can not intercept view results. May be you can write a view on top of a view, and in the transformation you can convert the way you want do.

           

          Ramesh..

          • 2. Re: file - delegating translator
            pinkstondevin

            Thank you Ramesh.