OData translator

The OData translator, known by the type name "odata" exposes the OData V2 and V3 data sources and uses the Teiid web services resource adapter for making web service calls. This translator is an extension of the Web services translator.

What is OData?

The Open Data Protocol (OData) web protocol is for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today. OData does this by applying and building upon Web technologies such as HTTP, Atom Publishing Protocol (AtomPub) and JSON to provide access to information from a variety of applications, services, and stores. OData is being used to expose and access information from a variety of sources including, but not limited to, relational databases, file systems, content management systems and traditional Web sites.

Using this specification from the OASIS group, with help from the OData4J framework, Teiid maps OData entities into relational schema. Teiid supports reading of CSDL (Conceptual Schema Definition Language) from the an OData endpoint provided, and converts the OData schema into relational schema. The following table shows the mapping selections in the OData translator from a CSDL document.

OData Mapped to relational entity

EntitySet

Table

FunctionImport

Procedure

AssociationSet

Foreign keys on the table*

ComplexType

ignored**

  • A many-to-many association will result in a link table that can not be selected from, but can be used for join purposes.

    • When used in functions, an implicit table is exposed. When used to define a embedded table, all the columns will be in-lined.

All CRUD operations will be appropriately mapped to the resulting entity based on the SQL submitted to the OData translator.

  1. Usage

Usage of a OData source is similar to that of a JDBC translator. The metadata import is supported through the translator, once the metadata is imported from source system and exposed in relational terms, then this source can be queried as if the EntitySets and Function Imports were local to the Teiid system.

Table 1. Execution properties
Name Description Default

DatabaseTimeZone

The time zone of the database. Used when fetchings date, time, or timestamp values.

The system default time zone

SupportsOdataCount

Supports $count.

true

SupportsOdataFilter

Supports $filter.

true

SupportsOdataOrderBy

Supports $orderby.

true

SupportsOdataSkip

Supports $skip.

true

SupportsOdataTop

Supports $top.

true

Table 2. Importer Properties
Name Description Default

schemaNamespace

Namespace of the schema to import.

null

entityContainer

Entity Container Name to import.

default container

Example: Importer settings to import only tables and views from NetflixCatalog
<property name="importer.schemaNamespace" value="System.Data.Objects"/>
<property name="importer.entityContainer" value="NetflixCatalog"/>
Note
OData Server is not fully compatible
The OData server that you connect to might not fully implement the entire OData specification. If the server’s OData implementation does not support a feature, set "execution properties" to turn off the corresponding capability, so that Teiid will not push down invalid queries to the translator.

For example, to turn off $filter, add following to your vdb.xml

    <translator name="odata-override" type="odata">
    <property name="SupportsOdataFilter" value="false"/>
    </translator>
Tip
Native queries
Native or direct query execution is not supported through the OData translator. However, you can use the invokehttp method of the Web services translator to issue REST-based calls, and then use SQLXML to parse results.
Tip
Using OData as server.
Teiid can not only consume OData-based data sources, but it can also expose any data source as an OData-based web service.

For more information about configuring an OData server, see OData Support.

JCA resource adapter

The resource adapter for this translator is a Web Service Data Source.

results matching ""

    No results matching ""