1 2 Previous Next 16 Replies Latest reply on Apr 27, 2017 2:43 AM by wickram09

    TEIID development for rest services without VDB

    wickram09

      Hi,

      I am a requirement to send query directly to rest service with filter without using VDB.

      because i have huge dataset and i dont want all data to be fetched.

      pls assist.

        • 1. Re: TEIID development for rest services without VDB
          rareddy

          Can you elaborate on the usecase?

           

          Teiid is data virtualization engine, where it helps to integrate data from different kinds of sources, one of them is REST sources. VDB is central to using Teiid, Teiid does not hold data, but it is can filter the data that has been fetched. If REST service is itself designed to NOT to take filter then there is not much you can not do but fetch all the data then filter in Teiid. Another option is modify the REST service itself directly to take the filter.

           

          Ramesh..

          • 2. Re: TEIID development for rest services without VDB
            wickram09

            Thanks ramesh for answering.

             

            usecase: there is one rest webservice integrated with mongo db contains huge data sets,

            need to call this rest service via teiid but is there any way to pass  query filters directly to service because there are many filters applies on that service,

            and i can  not make queries for all filters in VDB.

            i am expecting a generic query/translator which should push the filters to rest and populate the results (not full data sets).

            is there any way to handle such cases?

             

            thanks,

            • 3. Re: TEIID development for rest services without VDB
              rareddy

              If the REST service already supports the filters it is up to you how to build URL to send a query with a filter and get the results. If you generically looking for supporting *multiple* filters on rest service then you do need to write a custom translator for it, or write a view/procedure for each filter combination you need. For developing a custom translator take look at [1].

               

              [1] Developer’s Guide · Teiid Documentation

              • 4. Re: TEIID development for rest services without VDB
                wickram09

                Thanks Ramesh.

                • 5. Re: TEIID development for rest services without VDB
                  wickram09

                  I have one more query for developing ODATA v4 service using teiid where i can do all the queries like  select,filters,update,delete etc.

                  please assist how can i do it using teiid.?

                  I want to publish a ODATA v4 service using TEIID with multiple datasources.

                   

                   

                  thanks,

                  wickram

                  • 6. Re: TEIID development for rest services without VDB
                    rhn-engineering-rareddy

                    That is easy in Teiid it is provided out of the box, just develop a VDB and deploy and make sure it is ACTIVE state. Then all the OData querying is given to you by default. See [1] on how to access it.

                     

                    [1] OData Version 4.0 Support · Teiid Documentation

                    • 7. Re: TEIID development for rest services without VDB
                      wickram09

                      thanks:)

                      • 8. Re: TEIID development for rest services without VDB
                        wickram09

                        Hi Ramesh ,

                        i think it may be out of box question but need to clarify once.

                        now my question is : Can I pass odata query or any sql query or rest query  from client to  a translator directly for execution each time without creating any view/table or UDF in VDB , is it possible if yes then how?

                         

                        thanks,

                        wickram

                        • 9. Re: TEIID development for rest services without VDB
                          rareddy

                          You can create Dynamic VDB, representing the source and deploy that. With that you do not have to create tables, the metadata will be imported from your source directly. see Virtual Databases · Teiid Documentation

                          • 10. Re: TEIID development for rest services without VDB
                            wickram09

                            I have created dynamic VDB and created a view now i am able to perform odata operations.

                            BUT if i am passing a filter to teiid its not going directly to datasource/translator

                            again refreshing my question:--

                            how can I pass a filter queries each time directly to a datasource ex: mongodb or webservice?

                            I dont want to use any table/view/procedure in my VDB to fetch data from datasource

                            I want to do all querying directly  to the datasource not to view/table/procedure , is it possible in teiid ??

                            if possible or not possible , Please provide documentation for support.

                            so that i can justify the teiid concepts to my client.

                             

                            thanks,

                            wickram

                            • 11. Re: TEIID development for rest services without VDB
                              rareddy

                              Wickram,

                               

                              Seems like we are going in circles here I am afraid either I do not fully understand what you are trying to do, or you are trying to use Teiid for wrong usecases.

                               

                              > BUT if i am passing a filter to teiid its not going directly to datasource/translator

                              >how can I pass a filter queries each time directly to a datasource ex: mongodb or webservice?

                              How did you verify that? Passing on the filter on submitted query depends on the type of source you are using for querying. If this is a relational database, MongoDB yes in certain situations the filter is pushed to the source. If this is a web service, it is not possible to push a filter on the web service, as it has defined interface with which one needs to interact. In this case, Teiid applies the filter after it receives the results from the web service.

                               

                              > I dont want to use any table/view/procedure in my VDB to fetch data from datasource

                              Well Dynamic VDB, you did not define any tables on your own, it fetched the schema directly. If you are working with Web Service you have to define structure of your result in the form of a Table. Typically done using XMLTABLE construct. Look for examples in Teiid documentation.

                               

                              >I want to do all querying directly  to the datasource not to view/table/procedure , is it possible in teiid ??

                              Why are you using Teiid, when you can go directly to the sources? What is that you are trying to accomplish using Teiid?

                               

                              > if possible or not possible , Please provide documentation for support.

                              We got lot of documentation and you can see at Introduction · Teiid Documentation

                               

                              > so that i can justify the teiid concepts to my client.

                              My advise to you is, take little bit of time and read and work through couple of quick start examples and understand what Teiid does and how it does it, then you can see if this is really applicable to your usecase? If it does, then there are certain defined ways Teiid works, like creating data sources, tables/views in a VDB to provide that integrated view of the enterprise data from multiple sources.

                               

                              Going back and looking at your description of your usecase above, if you are trying to read data from MongoDB, then let Teiid talk to MongoDB using its own data source (not through the Rest Service as you say)  then when you issue query with filter it might get pushed to the source as expected, but not when you use rest interface.

                               

                              HTH.

                               

                              Ramesh..

                              • 12. Re: TEIID development for rest services without VDB
                                wickram09

                                Thanks ramesh for quick response.

                                I am trying again to explain abt my usecase as:

                                TEIID==>restwebservice==>mongodb

                                Teiid can't connect to mongodb directly teiid need to call ws and ws will call mongodb

                                so for teiid ws is a datasource.

                                i am able to do all odata operations on GET method through creating view.

                                (EXEC CustomerSource.invokeHttp('GET',null,'<URL>','TRUE'))

                                 

                                But for POST method i am getting below error on calling of  (EXEC CustomerSource.invokeHttp('POST','{"filter":{}}','<URL>','TRUE'))

                                --

                                Caused by: org.teiid.core.TeiidException: TEIID15005 Remote org.teiid.translator.TranslatorException: TEIID15005 Error Calling HTTP Service - 404 Not Found

                                    at org.teiid.translator.ws.BinaryWSProcedureExecution.execute(BinaryWSProcedureExecution.java:167)

                                    at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:365)

                                    at sun.reflect.GeneratedMethodAccessor91.invoke(Unknown Source)

                                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                                    at java.lang.reflect.Method.invoke(Method.java:498)

                                    at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:220)

                                    at com.sun.proxy.$Proxy29.execute(Unknown Source)

                                    at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:306)

                                    at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:112)

                                    at org.teiid.dqp.internal.process.DataTierTupleSource$1.call(DataTierTupleSource.java:108)

                                    at java.util.concurrent.FutureTask.run(FutureTask.java:266)

                                    at org.teiid.dqp.internal.process.FutureWork.run(FutureWork.java:65)

                                    ... 6 more

                                 

                                eventhough i can call the ws using resteasy client for POST method and rquest : {"filter":{}}

                                 

                                but not through TEIID.

                                 

                                Thanks,

                                wickram

                                • 13. Re: TEIID development for rest services without VDB
                                  rareddy

                                  What is "filter:{}"? Teiid does not understand the resteasy templates here, this needs to be absolute or relative URL.

                                  • 14. Re: TEIID development for rest services without VDB
                                    wickram09

                                    this is the request in json format.

                                    so, for teiid there should be URL (relative/absolute)?

                                    but i am passing the URL in EXEC method

                                      (EXEC CustomerSource.invokeHttp('POST','{"filter":{}}','<URL>','TRUE'))

                                     

                                    I want to push this request ({"filter":{}}) to the teiid odata supoorted url so that i would push to the webservice the same request.

                                    1 2 Previous Next