3 Replies Latest reply on Sep 5, 2019 10:23 AM by rareddy

    Support for OData complex types?

    monodot

      How can we provide/implement our own complex types when exposing an OData API from Teiid?

       

      For example, if I have a Postgresql table which has two underlying column names "PUBLISH_DATE_START" and "PUBLISH_DATE_END", is it possible to make these available as OData filter parameters, using the syntax "PublishDate/Start" and "PublishDate/End"?

       

      Hope my question makes sense.

       

      Thanks!

       

      Tom

        • 1. Re: Support for OData complex types?
          rareddy

          One way I can think of is create view of the table in Postgresql in Teiid, but do not expose those two columns. Then create another view with above PUBLISH_DATE columns along with the PK of the table. Now create 1 to 1 mapping between two. This will not create complex type but two entities and then you can use the navigation to get to it, which kind of similar.

          • 2. Re: Support for OData complex types?
            monodot

            Great, I was starting to use this approach, so I'm glad to hear I was on the right track!

             

            But I'm can't figure out how to implement a 1-to-1 mapping. Do you mean creating a third view, which combines the two views? I think that the column names would still be "flat", e.g. CREATE VIEW MyNewView (id bigint, publish_date_start date, ......), etc. Not sure how to explicitly define this 1-to-1 relationship.

             

            Thanks.

            • 3. Re: Support for OData complex types?
              rareddy

              When you create a view create Primary key and foreign key relations like shown between tables here Schema Object DDL · GitBook