2.10 - SELECT Syntax for the Presto Connector - Teradata QueryGrid

Teradata® QueryGrid™ Installation and User Guide

prodname
Teradata QueryGrid
vrm_release
2.10
created_date
September 2019
category
Administration
Configuration
Installation
User Guide
featnum
B035-5991-099K

You can use catalog_name.schema_name.table_name in the SELECT statements of your queries. If you do not specify a database, it defaults to the database that is configured for the connector properties in the QueryGrid portlet.

You can use this foreign server grammar in joins and any other place that you reference a normal table, including views, macros, and stored procedures.

Logical expressions such as AND, OR, GT, LT, LE, GE, EQ, ISNULL, IS NOT NULL, IN, and NOT IN are supported pushdown predicates.

For data type mappings from Teradata to Presto and Presto to Teradata, see QueryGrid Data Transformation.

Example: Presto to Teradata SELECT

The example shows an import initiated on Presto to fetch data from a remote Teradata system. The query predicates to be pushed are provided to the connector in the Constraint class by the Presto server and used for pushdown to the remote Teradata system.

SELECT MAKE, MODEL FROM QG_TD1.DB1.TD_CARDATA WHERE MAKE = 'BUICK';
make    model
------  --------------------
Buick   Century
Buick   Enclave

Where QG_TD1 is the catalog used to reference the Presto-to-Teradata link. DB1 is the database or schema name on the remote system, and TD_CARDATA is the table on the remote system.

Example: Teradata-to-Presto SELECT From Foreign Table with EXPORT

The example initiates a SELECT From Foreign Table with EXPORT request from Teradata to Presto. The Presto target connector creates a temporary table on the target Presto system, exports the data from the local Teradata Database, and imports the result of the join or aggregation query into the Teradata Database. In the example the remote table that is created is named pricetemp.

SELECT * FROM FOREIGN TABLE(SELECT p.make, SUM(quantity * price) 
  FROM pricetemp p, store.inventory q
  WHERE p.itemid = q.itemid GROUP BY p.partno)@presto1
  EXPORT((select * from monthlyprice) as pricetemp) as dt;