13 Replies Latest reply on Oct 6, 2010 2:51 AM by Bernd Groh

    How to use a custom translator?

    Bernd Groh Newbie

      Hi there,

       

      we've finally managed to package our own custom translator for Teiid 7.1 and deploy it to our server. When running the Designer, I can now see our custom translator in the respective tab. Yet, how do I use this custom translator for a VDB I want to query within the Designer? In MM, and in Teiid up to version 6.3, it was a matter of changing the name of the capabilities class in the vdb description and adding the relevant jars, yet, I no longer find these options in Teiid 7.1. Nor have I found any documentation on how to do this in Teiid 7.1.

       

      So, if anyone knows of a clear guide on how to use your custom translator within the Designer, it would be much appreciated.

       

      Let me know if you need any further information here.

       

      Cheers,

      Bernd

        • 1. Re: How to use a custom translator?
          Bernd Groh Newbie

          It dawned on me that it's probably a good idea to provide a little more background as to the exact issue we're facing, just in case the problem is elsewhere. We want to use certain database-specific functions of mysql, DATE_FORMAT being one. As such, I've created a functional model as part of our project and added the respective scalar function as push-down. Doing so, I can now use this function in my SQL statements without it throwing an error. I've equally added that functional model to the VDB. Now, when I attempt to preview data, it creates the preview VDBs on the server, attempts to execute the query, and then comes back with the following error:

           

          Error Code:ERR.015.008.0039 Message:Remote org.teiid.api.exception.query.QueryPlannerException: Error Code:ERR.015.008.0039 Message:Error Code:ERR.015.008.0039 Message:The function 'DATE_FORMAT(BugzillaVBL.bugs.bugs.creation_ts, '%Y%m%d')' is an unknown form.  Check that the function name and number of arguments is correct.

           

          I had issues such as these in MM, when the functional model was defined but the function itself wasn't declared in the Connector. I therefore assumed that the issues stem from using a standard mysql translator, instead of a custom translator, where this particular function has been added to the list of supported functions. Given Teiid 7.1 is all different, it occurred to me that the reason could actually be a different one here, so I figured it's better to at least provide some background.

           

          Cheers,
          Bernd

          • 2. Re: How to use a custom translator?
            Bernd Groh Newbie

            Actually, if you click on the VDB, and have a look in the Models section, you'll find a horizontal bar (stop looking for tabs), if you use that bar you can find a Translator column. This column should have a value for your imported model, i.e. the name of the translator. Try changing the name to the name of your custom translator. Could it really be that simple?

            • 3. Re: How to use a custom translator?
              Bernd Groh Newbie

              Unfortunately, not quite that simple. Even with using the name of our custom translator in the Translator column, we still get the same error.

               

              If anyone has any ideas as to what could be causing this, I'd much appreciate any input here.

               

              Cheers,

              Bernd

              • 4. Re: How to use a custom translator?
                Bernd Groh Newbie

                Actually, if I deploy the VDB, connect to it in the database perspective, and use the SQL scrapbook to issue queries, everything works fine. So the issue seems to be solely with the preview feature. After inspecting the VDBs with the console, I realized that the deployed VDB has an entry under Single Source Models for the respective database which denotes the custom translator name. None of the preview VDBs has that entry. Am I right to assume here that the preview VDBs simply do not use the right translator? If so, how can I tell the preview VDBs to use the same settings as the defined VDB, or, how can I tell it to use a particular custom translator? If that then is what's causing the issue.

                 

                Cheers,

                Bernd

                • 5. Re: How to use a custom translator?
                  Bernd Groh Newbie

                  I can actually confirm that the preview VDB isn't using the same translator as the defined VDB, which I've deployed. I overlooked this previously due to some console oddities.

                   

                  Here's the entry for the deployed VDB:

                   

                  Name Source Name Translator Name Connection JNDI Name Visible Supports Multi-source? Actions
                  BugzillaBugzillamyxsqlBugzillaDStruefalse

                   

                   

                  And here's the entry for the Preview VDB:

                   

                  Name Source Name Translator Name Connection JNDI Name Visible Supports Multi-source? Actions
                  BugzillaBugzillamysql5PREVIEW_8d1a3025-57a7-40e8-a6ae-2df6adc8aea9_DataStoreBNE_DataSources_Bugzillatruefalse

                   

                  While the deployed VDB uses the custom translator, named myxsql, the preview VDB does not.

                   

                  So, how do I tell the Designer to use the same translator as the VDB I've defined, or how do I tell it to use a particular custom translator?

                   

                  Cheers,

                  Bernd

                  • 6. Re: How to use a custom translator?
                    Barry LaFond Master

                    Bernd,

                     

                    Translators refer to a concept that hasn't been modeled in DTP and in Designer, can only be exposed via a Teiid instance. VDBs, are deployable artifacts and if you have a "Teiid" instance connection, you can select a Translator (i.e. name) in the VDB Editor (right-click source model row and select "Change Translator".

                     

                    For Previewing data within Designer, we rely on connection properties (including Translator name) being set on a model either during import, or via the "Modeling > Set Connection Profile" action. Unfortunately, we do not yet have a "Modeling > Set Translator Name" action to override the value being set via connection profile.

                     

                    I've logged a JIRA:  TEIIDDES-607 : Need a "Set Translator Name" action to allow using custom translators with Preview Data action.

                     

                    Though it's not recommended, you could use a Text Editor for your source model and change the translator property to your custom value: ( .......key="translator:name" value="myCustomTranslator"/>  )

                    Barry LaFond

                    Teiid Designer Project

                    • 7. Re: How to use a custom translator?
                      Bernd Groh Newbie

                      Hi Barry,

                       

                      I should have realized that the Preview Feature might not work with custom translators, so thank you for logging that JIRA. It would certainly be a most helpful feature. As to your "not recommended" suggestion...

                       

                      Though it's not recommended, you could use a Text Editor for your source model and change the translator property to your custom value: ( .......key="translator:name" value="myCustomTranslator"/>  )

                       

                      Given this seemed to be my only option to make the Preview Feature work with a custom translator, I went ahead and tried this. And yes, I can confirm that this is not to be recommended. After manually changing the respective entries in the xml, the Designer was giving me nothing but errors. First of all, I got a lot of "An unexpected error occurred running the Create Workspace Preview VDB for <path> job", and then I couldn't even edit the details for the VDB I had defined and deployed anymore. Instead of the form I was expecting in the vdb tab, all I got was "Could not open the editor: An exception was thrown during initialization". This didn't even change after promptly undoing the changes I made to the xml files. Looking at the stack trace, this seemed to have been "Caused by: java.lang.RuntimeException: org.eclipse.core.internal.resources.ResourceException: Resource is out of sync with the file system: <path>".

                       

                      Needless to say, nothing was working properly anymore, and I couldn't find a way to fix this at first. Luckily, I had the idea to clone the project. After cloning the project, and saving all, all the errors suddenly disappeared, even in the original project which I had cloned. So, I finally found a way to change the xml files to have the translator name to be my custom translator, and get the Designer working again. But...

                       

                      Same issue.

                       

                      All the xml files now show the name of my custom translator, and the data source Preview VDB even shows the name of my custom translator in the respective entry under Single Source Models, but I still get the same error trying to preview data.

                       

                      Could it be that it's due to that entry not being in every one of the Preview VDBs, or is there something else I am missing?

                       

                      Thanks,

                      Bernd

                      • 8. Re: How to use a custom translator?
                        Barry LaFond Master

                        I worked on the new action yesterday and it touched more of the code than I  would have predicted, so it doesn't surprise me now that you ran into trouble hand-editing the preview VDB.

                         

                        The Preview VDBs are constructed for each model. The only ones that need a translator are "Source" models. Because of the nature of Eclipse Resources (i.e. models, files, etc), our preview framework is required to keep in sync with your workspace. By hand-editing the VDB you would be bypassing that "sync" resulting in "Resource is out of sync...." among other things.

                         

                        Good news is the new action should be in the next release.

                         

                        Barry

                        • 9. Re: How to use a custom translator?
                          Bernd Groh Newbie

                          All the xml files now show the name of my custom translator, and the data source Preview VDB even shows the name of my custom translator in the respective entry under Single Source Models, but I still get the same error trying to preview data.

                           

                          Could it be that it's due to that entry not being in every one of the Preview VDBs, or is there something else I am missing?

                           

                          I guess I better provide some background here. I've got the following folder structure:

                           

                          DataSources

                          VirtualBaseLayer

                          VirtualTables

                           

                          DataSources contains the imported models, VirtualBaseLayer is just that, and VirtualTables are all the tables to be queried, sitting on top of the VirtualBaseLayer. That's the data I wish to preview as well.

                           

                          Looking at the console, I see the following Preview VDBs:

                           

                          DataSources

                          VirtualBaseLayer

                          VirtualTables

                          project

                           

                          DataSources is the only Preview VDB with the according entry:

                           

                          Name Source Name Translator Name Connection JNDI Name Visible Supports Multi-source? Actions
                          BugzillaBugzillamyxsqlPREVIEW_8d1a3025-57a7-40e8-a6ae-2df6adc8aea9_DataStoreBNE_DataSources_Bugzillatruefalse
                          SYSSYSSYSSYStruefalse

                           

                          All the other Preview VDBs, inclusive of VirtualTables, only have the following entry:

                           

                          Name Source Name Translator Name Connection JNDI Name Visible Supports Multi-source? Actions
                          SYSSYSSYSSYStruefalse

                           

                          I figured that every derived model would ultimately refer back to the imported model, but why then would there be different preview databases in the first place? It's probably something entirely different which I'm currently not seeing, but I figured I may as well bring it up, and be it only to understand it better myself.

                           

                          Thanks,

                          Bernd

                          • 10. Re: How to use a custom translator?
                            Bernd Groh Newbie

                            Good news is the new action should be in the next release.

                             

                            That's certainly good news. I guess for now I'll have to live without the preview feature.

                             

                            Thanks,

                            Bernd

                            • 11. Re: How to use a custom translator?
                              Bernd Groh Newbie

                              Good news is the new action should be in the next release.

                               

                              Just a follow-up here. Looking at the project page for the Teiid Designer[1], it says the following:

                               

                              • Unreleased 7.1.1 Release Date: Last Thursday

                               

                               

                              I haven't seen any release through the official channels yet. Has 7.1.1 been released yet, or not? Am still looking forward to it.

                               

                              Thanks,

                              Bernd

                               

                               

                              [1] https://jira.jboss.org/browse/TEIIDDES

                              • 12. Re: How to use a custom translator?
                                Ramesh Reddy Master

                                Bernd,

                                 

                                Why don't you give nightly build a try? This is where JBoss Tools keeps their staging stuff. This surely has the fix you are looking for.

                                 

                                http://download.jboss.org/jbosstools/builds/staging/jbosstools-teiid-designer/all/

                                 

                                Teiid Designer 7.2 will be the next community release, 7.1.1 is just a code branch to fix some known issues. This will be merged into trunk which will be 7.2. However I am sure, very soon Barry will be doing 7.2-alpha1 release with all the work from 7.1.x branch. I will let him speak about any specific dates.

                                 

                                Sorry for the delay, hopefully this helps you out meanwhile. Also helps the team to weed out any issues you may face before the release.

                                 

                                Thanks.

                                 

                                Ramesh..

                                • 13. Re: How to use a custom translator?
                                  Bernd Groh Newbie

                                  Why don't you give nightly build a try? This is where JBoss Tools keeps their staging stuff. This surely has the fix you are looking for.

                                   

                                  http://download.jboss.org/jbosstools/builds/staging/jbosstools-teiid-designer/all/

                                   

                                  Ok, thanks. I'll give that one a try.

                                   

                                  Bernd