JBoss Community Archive (Read Only)

Teiid 8.1

Built-in Translators

A Translator is typically paired with a particular JCA resource adapter. In instances where pooling, environment dependent configuration management, advanced security handling, etc. are not needed, then a JCA resource adapter is not needed. The configuration of JCA ConnectionFactories for needed resource adapters is not part of this guide, please see the Teiid Administrator Guide and the kit examples for configuring resource adapters for use in JBossAS.

Translators can have a number of configurable properties. These are broken down into execution properties, which determine aspects of how data is retrieved, and import settings, which determine what metadata is read for import.

The execution properties for a translator typically have reasonable defaults. For specific translator types, e.g. the Derby translator, base execution properties are already tuned to match the source. In most cases the user will not need to adjust their values.

Base Execution Properties - shared by all translators

Name

Description

Default

Immutable

Set to true to indicate that the source never changes.

false

RequiresCriteria

Set to true to indicate that source SELECT/UPDATE/DELETE queries require a where clause.

false

SupportsOrderBy

Set to true to indicate that the ORDER BY clause is supported.

false

SupportsOuterJoins

Set to true to indicate that OUTER JOINs are supported.

false

SupportsFullOuterJoins

If outer joins are supported, true indicates that FULL OUTER JOINs are supported.

false

SupportsInnerJoins

Set to true to indicate that INNER JOINs are supported.

false

SupportedJoinCriteria

If joins are supported, defines what criteria may be used as the join criteria. May be one of (ANY, THETA, EQUI, or KEY).

ANY

MaxInCriteriaSize

If in criteria are supported, defines what the maximum number of in entries are per predicate. -1 indicates no limit.

-1

MaxDependentInPredicates

If in criteria are supported, defines what the maximum number of predicates that can be used for a dependent join. Values less than 1 indicate to use only one in predicate per dependent value pushed (which matches the pre-7.4 behavior).

-1

Only a subset of the supports metadata can be set through execution properties. If more control is needed, please consult the Developer's Guide.

There are no base importer settings.

For all the translators to override Execution Properties can be configured in the vdb.xml file.

Example Overriding of Translator Property
<translator type="oracle-override" name="oracle">
     <property value="RequiresCriteria" name="true"/>
</translator>

The above XML fragment is overriding the oracle translator and altering the behavior of RequiresCriteria property to true. Note that the modified translator is only available in the scope of this VDB.

File Translator

The file translator, known by the type name file, exposes stored procedures to leverage file system resources exposed by the file resource adapter. It will commonly be used with the TEXTTABLE or XMLTABLE table functions to use CSV or XML formated data.

Name

Description

Default

Encoding

The encoding that should be used for CLOBs returned by the getTextFiles procedure

The system default encoding

ExceptionIfFileNotFound

Throw an exception in getFiles or getTextFiles if the specified file/directory does not exist.

false

Execution Properties

Usage

Retrieve all files as BLOBs with an optional extension at the given path.

call getFiles('path/*.ext')

If the extension path is specified, then it will filter all of the file in the directory referenced by the base path. If the extension pattern is not specified and the path is a directory, then all files in the directory will be returned. Otherwise the single file referenced will be returned. If the path doesn't exist, then no results will be returned if ExceptionIfFileNotFound is false, otherwise an exception will be raised.

Retrieve all files as CLOB(s) with the an optional extension at the given path.

call getTextFiles('path/*.ext')

All the same files a getFiles will be retrieved, the only difference is that the results will be CLOB values using the encoding execution property as the character set.

Save the CLOB, BLOB, or XML value to given path

call saveFile('path', value)

The path should reference a new file location or an existing file to overwrite completely.

JCA Resource Adapter

The resource adapter for this translator provided through "File Data Source", Refer to Admin Guide for configuration information.

JDBC Translator

The JDBC translator bridges between SQL semantic and data type difference between Teiid and a target RDBMS. Teiid has a range of specific translators that target the most popular open source and proprietary databases.

Type names:* jdbc-ansi- declares support for most SQL constructs supported by Teiid, except for row limit/offset and EXCEPT/INTERCECT. Translates source SQL into ANSI compliant syntax. This translator should be used when another more specific type is not available.

  • jdbc-simple- same as jdbc-ansi, except disables support for function, UNION, and aggregate pushdown.

  • access- for use with Microsoft Access 2003 or later.

  • db2- for use with DB2 8 or later.

  • derby- for use with Derby 10.1 or later.

  • excel-odbc- for use with Excel 2003 or later via the JDBC-ODBC bridge.

  • greenplum- for use with the Greenplum database.

  • h2- for use with H2 version 1.1 or later.

  • hive- For use with Hive database based on Hadoop. Hive is a data warehousing infrastructure based on the Hadoop. Hadoop provides massive scale out and fault tolerance capabilities for data storage and processing (using the map-reduce programming paradigm) on commodity hardware. Hive has limited support for data types as it supports integer variants, boolean, float, double and string. It is does not have native support for time based types, xml or LOBs. These limitations are reflected in the translator capabilities. The view table can use these types, however the transformation would need to specify the necessary transformations. Note that in those situations, the evaluations will be done in Teiid engine. Another limitation Hive has is, it only supports EQUI join, so using any other joins types on its source tables will result in in-efficient queries. Currently there is no tooling support for metadata import from Hive in Designer. To write criteria based on partitioned columns, they can be modelled on source table, but do not include in selection columns.

  • hsql- for use with HSQLDB 1.7 or later.

  • ingres- for use with Ingres 2006 or later.

  • ingres93- for use with Ingres 9.3 or later.

  • intersystems-cache- for use with Intersystems Cache Object database (only relational aspect of it)

  • informix- for use with any Informix version.

  • metamatrix- for use with MetaMatrix 5.5.0 or later.

  • modeshape- for use with Modeshape 2.2.1 or later. The PATH, NAME, LOCALNODENAME, DEPTH, and SCORE functions should be accessed as pseudo-columns, e.g. "nt:base"."jcr:path". Teiid UFDs (prefixed by JCR_) are available for CONTIANS, ISCHILDNODE, ISDESCENDENT, ISSAMENODE, REFERENCE - see the JCRFunctions.xmi. If a selector name is needed in a JCR function, you should use the pseudo-column "jcr:path", e.g. JCR_ISCHILDNODE(foo.jcr_path, 'x/y') would become ISCHILDNODE(foo, 'x/y') in the ModeShape query. An additional pseudo-column "mode:properties" should be imported by setting the ModeShape JDBC connection property teiidsupport=true. The column "mode:properties" should be used by the JCR_REFERENCE and other functions that expect a .* selector name, e.g. JCR_REFERENCE(nt_base.jcr_properties) would become REFERENCE("nt:base".*) in the ModeShape query.

  • mysql/mysql5- for use with MySQL version 4.x and 5 or later respectively.
    The MySQL Translators expect the database or session to be using ANSI mode. If the database is not using ANSI mode, an initialization query should be used on the pool to set ANSI mode:

    set SESSION sql_mode = 'ANSI'
  • netezza - for use with any Netezza version.

  • oracle- for use with Oracle 9i or later. Sequences may be used with the Oracle translator. A sequence may be modelled as a table with a name in source of DUAL and columns with the name in source set to <sequence name>.[nextval|currentval]. You can use a sequence as the default value for insert columns by setting the column to autoincrement and the name in source to <element name>:SEQUENCE=<sequence name>.<sequence value>. A rownum column can also added to any Oracle physical table to support the rownum pseudo-column. A rownum colum should have a name in source of rownum. These rownum columns do not have the same semantics as the Oracle rownum construct so care must be taken in their usage.
    Oracle specific execution properties:

    • OracleSuppliedDriver- indicates that the Oracle supplied driver (typically prefixed by ojdbc) is being used. Defaults to true. Set to false when using DataDirect or other Oracle JDBC drivers.

  • postgresql- for use with 8.0 or later clients and 7.1 or later server.

  • sqlserver- for use with SQL Server 2000 or later. A SQL Server JDBC driver version 2.0 or later (or compatible e.g. JTDS 1.2 or later) should be used.  SQL Server specific execution properties:

    • JtdsDriver- indicates that the open source JTDS driver is being used. Defaults to false.

  • sybase- for use with Sybase version 12.5 or later.  Sybase specific execution properties:

    • JtdsDriver- indicates that the open source JTDS driver is being used. Defaults to false.

  • teiid- for use with Teiid 6.0 or later.

  • teradata- for use with Teradata V2R5.1 or later.

Execution Properties - shared by all JDBC Translators

Name

Description

Default

DatabaseTimeZone

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

The system default time zone

DatabaseVersion

The specific database version. Used to further tune pushdown support.

The base supported version

TrimStrings

true to trim trailing whitespace from fixed length character strings. Note that Teiid only has a string, or varchar, type that treats trailing whitespace as meaningful.

false

UseBindVariables

true to indicate that PreparedStatements should be used and that literal values in the source query should be replace with bind variables. If false only LOB values will trigger the use of PreparedStatements.

true

UseCommentsInSourceQuery

This will embed a /comment/ leading comment with session/request id in source SQL query for informational purposes

false

MaxPreparedInsertBatchSize

The max size of a prepared insert batch.

2048

Importer Properties - shared by all JDBC Translators

Name

Description

Default

catalog

See DatabaseMetaData.getTablesFull [1]

null

schemaPattern

See DatabaseMetaData.getTables [1]

null

tableNamePattern

See DatabaseMetaData.getTables [1]

null

procedurePatternName

See DatabaseMetaData.getProcedures [1]

null

tableTypes

Comma separated list - without spaces - of imported table types. See DatabaseMetaData.getTables [1]

null

excludeTables

A case-insensitive regular expression that when matched against a fully qualified table name will exclude it from import.  Applied after table names are retrieved.  Use a negative look-ahead (?!<inclusion pattern>).* to act as an inclusion filter.

null

excludeProcedures

A case-insensitive regular expression that when matched against a fully qualified procedure name will exclude it from import.  Applied after procedure names are retrieved.  Use a negative look-ahead (?!<inclusion pattern>).* to act as an inclusion filter.

null

useFullSchemaName

When false, directs the importer to drop the source catalog/schema from the Teiid object name, so that the Teiid fully qualified name will be in the form of <model name>.<table name> - Note: that this may lead to objects with duplicate names when importing from multiple schemas, which results in an exception

true

importKeys

true to import primary and foreign keys

true

importIndexes

true to import index/unique key/cardinality information

true

importApproximateIndexes

true to import approximate index information. See DatabaseMetaData.getIndexInfo [1]

true

importProcedures

true to import procedures and procedure columns - Note that it is not always possible to import procedure result set columns due to database limitations. It is also not currently possible to import overloaded procedures.

true

widenUnsignedTypes

true to convert unsigned types to the next widest type. For example SQL Server reports tinyint as an unsigned type. With this option enabled, tinyint would be imported as a short instead of a byte.

true

quoteNameInSource

false will override the default and direct Teiid to create source queries using unquoted identifiers.

true

useProcedureSpecificName

true will allow the import of overloaded procedures (which will normally result in a duplicate procedure error) by using the unique procedure specific name as the Teiid name. This option will only work with JDBC 4.0 compatible drivers that report specific names.

false

useCatalogName

true will use any non-null/non-empty catalog name as part of the name in source, e.g. "catalog"."table"."column", and in the Teiid runtime name if useFullSchemaName is true. false will not use the catalog name in either the name in source or the Teiid runtime name. Should be set to false for sources that do not fully support a catalog concept, but return a non-null catalog name in their metadata - such as HSQL.

true

[1] JavaDoc for DatabaseMetaData

Warning

The default import settings will crawl all available metadata. This import process is time consuming and full metadata import is not needed in most situations. Most commonly you'll want to limit import by schemaPattern and tableTypes.

Example importer settings to only import tables and views from my-schema.

...
<property name="importer.tableTypes" value="TABLE,VIEW"/>
<property name="importer.schemaPattern" value="my-schema"/>
...

Usage

Usage of a JDBC source is straight-forward. Using Teiid SQL, the source may be queried as if the tables and procedures were local to the Teiid system.

Native Queries

Both physical tables and procedures may optionally have native queries associated with them.  No validation of the native query is performed, it is simply used in a straight-forward manner to generate the source SQL.  For a physical table setting the {http://www.teiid.org/ext/relational/2012}native-query extension metadata to the desired query string will have Teiid execute the native query as an inline view in the source query.  This feature should only be used against sources that support inline views.  For example on a physical table y with nameInSource="x" and {http://www.teiid.org/ext/relational/2012}native-query="select c from g", the Teiid source query"SELECT c FROM y" would generate the SQL query "SELECT c FROM (select c from g) as x".  Note that the column names in the native query must match the nameInSource of the physical table columns for the resulting SQLto be valid.

For physical procedures you may also set the {http://www.teiid.org/ext/relational/2012}native-query extension metadata to a desired query string with the added ability to positionally reference IN parameters.  A parameter reference has the form$integer, e.g. $1.  Note that 1 based indexing is used and that only IN parameters may be referenced.  Dollar-sign integer is reserved in physical procedure native queries.  To use a $integer directly, it must be escaped with another $, e.g. $$1.By default bind values will be used for parameter values.  In some situations you may wish to bind values directly into the resulting SQL.  The {http://www.teiid.org/ext/relational/2012}non-prepared extension metadata property may be set to false to turn off parameter binding.  Note this option should be used with caution as inbound may allow for SQL injection attacks if not properly validated.  The native query does not need to call a stored procedure.  Any SQL that returns a result set positionally matching the result set expected by the physical stored procedure metadata will work.  For example on a stored procedure x with {http://www.teiid.org/ext/relational/2012}native-query="select c from g where c1 = $1 and c2 = '$$1'", the Teiid source query"CALL x(?)" would generate the SQL query "select c from g where c1 = ? and c2 = '$1'".  Note that ? in this example will be replaced with the actual value bound to parameter 1.

JCA Resource Adapter

The resource adapter for this translator provided through data source in JBoss AS, Refer to Admin Guide for "JDBC Data Sources" configuration section.

LDAP Translator

The LDAP translator, known by the type name ldap, exposes an LDAP directory tree relationally with pushdown support for filtering via criteria. This is typically coupled with the LDAP resource adapter.

Execution Properties

Name

Description

Default

SearchDerfaultBaseDN

Default Base DN for LDAP Searches

null

SearchDefaultScope

Default Scope for LDAP Searches. Can be one of SUBTREE_SCOPE, OBJECT_SCOPE, ONELEVEL_SCOPE.

ONELEVEL_SCOPE

RestrictToObjectClass

Restrict Searches to objectClass named in the Name field for a table

false

UsePagination

Use a PagedResultsControl to page through large results. This is not supported by all directory servers.

false

ExceptionOnSizeLimitExceeded

Set to true to throw an exception when a SizeLimitExceededException is received and a LIMIT is not properly enforced.

false

There are no import settings for the ldap translator; it also does not provide metadata.

Metadata Directives

String columns with a default value of "multivalued-concat" will concatinate all attribute values together in alphabetical order using a ? delimiter. If a multivalued attribute does not have a default value of "multivalued-concat", then any value may be returned.

JCA Resource Adapter

The resource adapter for this translator provided through "LDAP Data Source", Refer to Admin Guide for configuration.

Loopback Translator

The Loopback translator, known by the type name loopback, provides a quick testing solution. It supports all SQL constructs and returns default results, with configurable behavior.

Execution Properties

Name

Description

Default

ThrowError

true to always throw an error

false

RowCount

Rows returned for non-update queries.

1

WaitTime

Wait randomly up to this number of milliseconds with each sourc query.

0

PollIntervalInMilli

if positive results will be "asynchronously" returned - that is a DataNotAvailableException will be thrown initially and the engine will wait the poll interval before polling for the results.

-1

There are no import settings for the Loopback translator; it also does not provide metadata - it should be used as a testing stub.

JCA Resource Adapter

The source connection is required for this translator

Salesforce Translator

The Salesforce translator, known by the type name salesforce supports the SELECT, DELETE, INSERT and UPDATE operations against a Salesforce.com account. It is designed for use with the Teiid Salesforce resource adapter.

Name

Description

Default

ModelAuditFeilds

Audit Model Fields

false

Execution Properties

The Salesforce translator can import metadata, but does not currently have import settings.

SQL Processing

Salesforce does not provide the same set of functionality as a relational database. For example, Salesforce does not support arbitrary joins between tables. However, working in combination with the Teiid Query Planner, the Salesforce connector supports nearly all of the SQL syntax supported by the Teiid.

The Salesforce Connector executes SQL commands by “pushing down” the command to Salesforce whenever possible, based on the supported capabilities. Teiid will automatically provide additional database functionality when the Salesforce Connector does not explicitly provide support for a given SQL construct. In these cases, the SQL construct cannot be “pushed down” to the data source, so it will be evaluated in Teiid, in order to ensure that the operation is performed.

In cases where certain SQL capabilities cannot be pushed down to Salesforce, Teiid will push down the capabilities that are supported, and fetch a set of data from Salesforce. Then, Teiid will evaluate the additional capabilities, creating a subset of the original data set. Finally, Teiid will pass the result to the client.

SELECT sum(Reports) FROM Supervisor where Division = 'customer support';

Neither Salesforce nor the Salesforce Connector support the sum() scalar function, but they do support CompareCriteriaEquals, so the query that is passed to Salesforce by the connector will be transformed to this query.

SELECT Reports FROM Supervisor where Division = 'customer support';

The sum() scalar function will be applied by the Teiid Query Engine to the result set returned by the connector.

In some cases multiple calls to the Salesforce application will be made to support the SQL passed to the connector.

DELETE From Case WHERE Status = 'Closed';

The API in Salesforce to delete objects only supports deleting by ID. In order to accomplish this the Salesforce connector will first execute a query to get the IDs of the correct objects, and then delete those objects. So the above DELETE command will result in the following two commands.

SELECT ID From Case WHERE Status = 'Closed';
DELETE From Case where ID IN (<result of query>);

*The Salesforce API DELETE call is not expressed in SQL, but the above is an SQL equivalent expression.

It's useful to be aware of unsupported capabilities, in order to avoid fetching large data sets from Salesforce and making you queries as performant as possible. See all Supported Capabilities.

Selecting from Multi-Select Picklists

A multi-select picklist is a field type in Salesforce that can contain multiple values in a single field. Query criteria operators for fields of this type in SOQL are limited to EQ, NE, includes and excludes. The full Salesforce documentation for selecting from mullti-select picklists can be found at the following link. Querying Mulit-select Picklists

Teiid SQL does not support the includes or excludes operators, but the Salesforce connector provides user defined function definitions for these operators that provided equivalent functionality for fields of type multi-select. The definition for the functions is:

boolean includes(Column column, String param)
boolean excludes(Column column, String param)

For example, take a single multi-select picklist column called Status that contains all of these values.

  • current

  • working

  • critical

For that column, all of the below are valid queries:

SELECT * FROM Issue WHERE true = includes (Status, 'current, working' );
SELECT * FROM Issue WHERE true = excludes (Status, 'current, working' );
SELECT * FROM Issue WHERE true = includes (Status, 'current;working, critical' );

EQ and NE criteria will pass to Salesforce as supplied. For example, these queries will not be modified by the connector.

SELECT * FROM Issue WHERE Status = 'current';
SELECT * FROM Issue WHERE Status = 'current;critical';
SELECT * FROM Issue WHERE Status != 'current;working';

Selecting All Objects

The Salesforce connector supports the calling the queryAll operation from the Salesforce API. The queryAll operation is equivalent to the query operation with the exception that it returns data about all current and deleted objects in the system.

The connector determines if it will call the query or queryAll operation via reference to the isDeleted property present on each Salesforce object, and modeled as a column on each table generated by the importer. By default this value is set to False when the model is generated and thus the connector calls query. Users are free to change the value in the model to True, changing the default behavior of the connector to be queryAll.

The behavior is different if isDeleted is used as a parameter in the query. If the isDeleted column is used as a parameter in the query, and the value is 'true' the connector will call queryAll.

select * from Contact where isDeleted = true;

If the isDeleted column is used as a parameter in the query, and the value is 'false' the connector perform the default behavior will call query.

select * from Contact where isDeleted = false;

Selecting Updated Objects

If the option is selected when importing metadata from Salesforce, a GetUpdated procedure is generated in the model with the following structure:

GetUpdated (ObjectName IN string,
	StartDate IN datetime,
	EndDate IN datetime,
	LatestDateCovered OUT datetime)
returns
	ID string

See the description of the GetUpdated operation in the Salesforce documentation for usage details.

Selecting Deleted Objects

If the option is selected when importing metadata from Salesforce, a GetDeleted procedure is generated in the model with the following structure:

GetDeleted (ObjectName IN string,
	StartDate IN datetime,
	EndDate IN datetime,
	EarliestDateAvailable OUT datetime,
	LatestDateCovered OUT datetime)
returns
	ID string,
	DeletedDate datetime

See the description of the GetDeleted operation in the Salesforce documentation for usage details.

Relationship Queries

Salesforce does not support joins like a relational database, but it does have support for queries that include parent-to-child or child-to-parent relationships between objects. These are termed Relationship Queries. The SalesForce connector supports Relationship Queries through Outer Join syntax.

SELECT Account.name, Contact.Name from Contact LEFT OUTER JOIN Account
on Contact.Accountid = Account.id

This query shows the correct syntax to query a SalesForce model with to produce a relationship query from child to parent. It resolves to the following query to SalesForce.

SELECT Contact.Account.Name, Contact.Name FROM Contact
select Contact.Name, Account.Name from Account Left outer Join Contact
on Contact.Accountid = Account.id

This query shows the correct syntax to query a SalesForce model with to produce a relationship query from parent to child. It resolves to the following query to SalesForce.

SELECT Account.Name, (SELECT Contact.Name FROM
Account.Contacts) FROM Account

See the description of the Relationship Queries operation in the SalesForce documentation for limitations.

Supported Capabilities

The following are the the connector capabilities supported by the Salesforce Connector. These SQL constructs will be pushed down to Salesforce.

  • SELECT command

  • INSERT Command

  • UPDATE Command

  • DELETE Command

  • CompareCriteriaEquals

  • InCriteria

  • LikeCriteria - Supported for String fields only.

  • RowLimit

  • AggregatesCountStar

  • NotCriteria

  • OrCriteria

  • CompareCriteriaOrdered

  • OuterJoins with join criteria KEY

JCA Resource Adapter

The resource adapter for this translator provided through "Salesforce Data Source", Refer to Admin Guide for configuration.

Web Services Translator

The Web Services translator, known by the type name ws, exposes stored procedures for calling web services backed by a Teiid WS resource adapter. It will commonly be used with the TEXTTABLE or XMLTABLE table functions to use CSV or XML formated data.

Setting the proper binding value on the translator is recommended as it removes the need for callers to pass an explict value. If your service is actually uses SOAP11, but the binding used SOAP12 you will receive execution failures.

Execution Properties

Name

Description

Default

DefaultBinding

The binding that should be used if one is not specified. Can be one of HTTP, SOAP11, or SOAP12

SOAP12

DefaultServiceMode

The default service mode. For SOAP, MESSAGE mode indicates that the request will contain the entire SOAP envelope and not just the contents of the SOAP body. Can be one of MESSAGE or PAYLOAD

PAYLOAD

XMLParamName

Used with the HTTP binding (typically with the GET method) to indicate that the request document should be part of the query string.

null - unused

There are ws importer settings, but it does provide metadata for dynamic VDBs.

Usage

The WS translator exposes low level procedures for accessing web services. See also the ws-weather example in the kit.

Invoke Procedure

Invoke allows for multiple binding, or protocol modes, including HTTP, SOAP11, and SOAP12.

Procedure invoke(binding in STRING, action in STRING, request in XML, endpoint in STRING) returns XML

The binding may be one of null (to use the default) HTTP, SOAP11, or SOAP12. Action with a SOAP binding indicates the SOAPAction value. Action with a HTTP binding indicates the HTTP method (GET, POST, etc.), which defaults to POST.

A null value for the binding or endpoint will use the default value. The default endpoint is specified in the WS resource adapter configuration. The endpoint URL may be absolute or relative. If it's relative then it will be combined with the default endpoint.

Since multiple parameters are not required to have values, it is often more clear to call the invoke procedure with named parameter syntax.

call invoke(binding=>'HTTP', action=>'GET')

The request XML should be a valid XML document or root element.

InvokeHTTP Procedure

invokeHttp can return the byte contents of an HTTP(S) call.

Procedure invokeHttp(action in STRING, request in OBJECT, endpoint in STRING, contentType out STRING) returns BLOB

Action indicates the HTTP method (GET, POST, etc.), which defaults to POST.

A null value for endpoint will use the default value. The default endpoint is specified in the WS resource adapter configuration. The endpoint URL may be absolute or relative. If it's relative then it will be combined with the default endpoint.

Since multiple parameters are not required to have values, it is often more clear to call the invoke procedure with named parameter syntax.

call invokeHttp(action=>'GET')

The request can be one of SQLXML, STRING, BLOB, or CLOB. The request will be sent as the POST payload in byte form. For STRING/CLOB values this will default to the UTF-8 encoding. To control the byte encoding, see the to_bytes function.

JCA Resource Adapter

Theresource adapter for this translator provided through "Web Service Data Source", Refer to Admin Guide for configuration.

OLAP Translator

The OLAP Services translator, known by the type name olap, exposes stored procedures for calling analysis sevices backed by a OLAP server using MDX query lanaguage. This translator exposes a stored procedure, invokeMDX, that returns a result set containing tuple array values for a given MDX query. invokeMDX will commonly be used with the ARRAYTABLE table function to extract the results.

Since the Cube metadata exposed by the OLAP servers and relational database metadata are so different, there is no single way to map the metadata from one to other. It is best to query OLAP system using its own native MDX language through. MDX queries my be defined statically or built dynamically in Teiid's abstraction layers.

Usage

The olap translator exposes one low level procedure for accessing olap services.

InvokeMDX Procedure

invokeMdx returns a resultset of the tuples as array values.

Procedure invokeMdx(mdx in STRING) returns resultset (tuple object)

The mdx parameter is a MDX query to be executed on the OLAP server.

The results of the query will be returned such that each row on the row axis will be packed into an array value that will first contain each hierarcy member name on the row axis then each measure value from the column axis.

The use of Data Roles should be considered to prevent arbitrary MDX from being submitted to the invokeMDX procedure.

JCA Resource Adapter

The resource adapter for this translator provided through data source in JBoss AS, Refer to Admin Guide for "JDBC Data Sources" configuration section. Two sample -ds.xml files provided for accessing OLAP servers in teiid-examples section. One is Mondrian specific, when Mondrian server is deloyed in the same JBoss AS as Teiid (mondrian-ds.xml). To access any other OLAP servers using XMLA interface, the data source for them can be created using them example template olap-xmla-ds.xml

Delegating Translators

You may create a delegating translator by extending the org.teiid.translator.BaseDelegatingExecutionFactory. Once your classes are then packaged as a custom translator, you will be able to wire another translator instance into your delegating translator at runtime in order to intercept all of the calls to the delegate. This base class does not provide any functionality on its own, other than delegation.

Execution Properties

Name

Description

Default

delegateName

Translator instance name to delegate to

Lets say you are currently using "oracle" translator in your VDB, you want to intercept the calls going through this translator, then you first write a custom delegating translator like

@Translator(name="interceptor", description="interceptor")
public class InterceptorExecutionFactory extends org.teiid.translator.BaseDelegatingExecutionFactory{
    @Override
    public void getMetadata(MetadataFactory metadataFactory, C conn) throws TranslatorException {
        // do intercepting code here..

        // If you want call the original delegate, do not call if do not need to.
        // but if you did not call the delegate fullfill the method contract
        super.getMetadata(metadataFactory, conn);

        // do more intercepting code here..
    }
}

Now deploy this translator in Teiid engine. Then in your -vdb.xml or .vdb file define like below.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vdb name="myvdb" version="1">

    <model name="mymodel">
        <source name="source" translator-name="oracle-interceptor" connection-jndi-name="java:oracle-ds"/>
    </model>

    <!-- the below it is called translator overriding, where you can set different properties -->
    <translator name="orcle-interceptor" type="interceptor" />
        <property name="delegateName" value="oracle" />
   </translator>
</vdb>

We have defined a "translator" override called "oracle-interceptor", which is based on the custom translator "interceptor" from above, and supplied the translator it needs to delegate to "oracle" as its delegateName. Then, we used this override translator "oracle-interceptor" in your VDB. Now any calls going into this VDB model's translator will be intercepted by YOUR code to do whatever you want to do.

JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-13 12:08:51 UTC, last content change 2012-08-14 17:30:07 UTC.