8 Replies Latest reply on Sep 18, 2014 8:51 AM by rareddy

    complex view defined in static vdb

    gulzaib.gondal

      Hi,

       

      If we have a complex view for example with multiple joins between different source tables defined in static vdb

       

      If we access it using a url we obviously take this view as a black box and maps orderby and other conditions on the underlying view.

       

      I need a pointer to the api of teiid where this mapping happens

       

      Thanks

        • 1. Re: complex view defined in static vdb
          shawkins

          By accessing via URL do you mean odata / webservices?

           

          There is quite a lot of logic in the engine.  It starts with the parser teiid/engine/src/main/java/org/teiid/query/parser at master · teiid/teiid · GitHub converting the incoming query into our language objects, these then pass through our resolver which is the first level mapping to the metadata teiid/engine/src/main/java/org/teiid/query/resolver at master · teiid/teiid · GitHub as it ensures the query references valid tables/columns and ensures the type information is correct.  From there the query undergoes the optimization/planning process teiid/engine/src/main/java/org/teiid/query/optimizer at master · teiid/teiid · GitHub

          1 of 1 people found this helpful
          • 2. Re: complex view defined in static vdb
            gulzaib.gondal

            Thanks for prompt reply will explore these API actually what i want to do is that I want to execute a custom query merged with odata url

             

            First

             

            QueryParser.getQueryParser().parseCommand(queryString);

             

            to translate in to language objects then

             

            languageBridgeFactory.translate(comand) to get executeable command

             

            and then manually merging information from odata url command to this command, i wanted to know any good way of doing this automaticllay

             

            but in between I am doing a noobish thin i.e

             

            BasicQueryMetadata metadata = new BasicQueryMetadata();

             

             

              LanguageBridgeFactory languageBridgeFactory = new LanguageBridgeFactory(

              metadata);

            • 3. Re: complex view defined in static vdb
              rareddy

              Can you give an example of OData URL you are talking about? There may be a simpler solution we can point it out.

               

              BTW, The URL in OData is a standard URL, extensions to URL are not allowed without lot of code modifications, and that is only on interface layer. Query engine another layer, which I see are going against. Have you looked at creating a rest procedure using other ways in Teiid, there you have full flexibility of defining your URL as you want, and possibly merge your query all in the modeling not using code.

               

              Ramesh..

              • 4. Re: complex view defined in static vdb
                gulzaib.gondal

                thanks for the interest,

                 

                Actually I may have not been able to communicate correctly earlier let me elaborate below:

                 

                purpose of followin is to expose complex views (i.e. multiple joins union etc) as a view using dynamic vdb

                 

                - We create our own metadata through a custom translator extending oracle translatory

                - metadata has name of columns and view name to be accessed

                 

                for example following information is in metadata

                 

                Table1

                     Column1

                     Column2

                 

                now we access it using url

                 

                http://localhost:8080/server/dsl.svc/mds/1/Dynamic-VDB/TABLE1?$select=Column1&$filter=Column2 eq 'abc'

                 

                now the command made by url will be like

                 

                select g_0.Column1 from Table1 as g_0 where g_0.Column1='abc'

                 

                Table1 do not exist in meadata so in translator we form our own command using methods above from query below

                 

                select a.col1 b.col2 from atable as a inner join btable as b where a.col2=b.col3

                 

                and then I programmatically merge two commands.

                 

                We can use static vdb here but some other constraint prevent us from doing that

                 

                Any hint towards using any teiid class to merge two commands would be use full

                 

                thanks

                • 5. Re: complex view defined in static vdb
                  shawkins

                  > metadata has name of columns and view name to be accessed

                   

                  Are you saying that the metadata is defining views or are you exposing tables then having the translator handle what the table access should mean once there is a pushdown query?

                   

                  > and then I programmatically merge two commands.

                   

                  I may not be following correctly.  Which two commands are you referring to?

                  • 6. Re: Re: complex view defined in static vdb
                    rareddy

                    I think I go back even little more and ask, what kind of source you are connecting to to access "atable" and "btable"?

                     

                    If they are from relational database, or any other source Teiid supports, Teiid already does what you are trying to accomplish. If not write your translator to expose "atable" and "btable", then use Teiid View model to define logical layer that defines the "Table1" with "column1 & colum2" that has the transformation as "select a.col1 b.col2 from atable as a inner join btable as b where a.col2=b.col3" then everything else is supplied by Teiid engine.

                    1 of 1 people found this helpful
                    • 7. Re: complex view defined in static vdb
                      gulzaib.gondal

                      atable and btable are from oracle

                       

                      We can not use ddl to define metadata due to some other contraints so we are using our own metadata loader,

                       

                      which class will have transformation query ?

                       

                      thanks for the previous responses

                      • 8. Re: complex view defined in static vdb
                        rareddy

                        Please explain the constraints, not knowing them we can not suggest what is right way to solve the issue. BTW, you do not have to write code define the metadata, if you are using Designer, you can use graphical tool to do that, if you are using Dynamic VDB you can use DDL to define it.

                         

                        There is no class for transformation query. Teiid is not a API framework, it is a tool. So, integration happens in configuration, which in this case is a VDB. Please read basics here The Basics · Teiid, then try work with some sample quick starts Home - Teiid Examples - Project Documentation Editor

                         

                        Ramesh..