2.06 - Configuring a Foreign Server for a Spark SQL-to-TargetConnector - Teradata QueryGrid

Teradata® QueryGrid™ Installation and User Guide

Product
Teradata QueryGrid
Release Number
2.06
Published
September 2018
Language
English (United States)
Last Update
2018-11-26
dita:mapPath
blo1527621308305.ditamap
dita:ditavalPath
ft:empty
The Data Sources API framework is used for the Teradata QueryGrid Spark SQL initiator connector. Data Sources API allows Spark SQL to access data stored on other systems. A Spark SQL table created using a Data Source API framework is referred to as a non-native table.

The Data Sources API operates at the table level by default, so one non-native table must be created for each remote table, unlike Teradata Foreign Servers and Presto Catalogs that operate at the database level. However, a Foreign Server Library has been included as part of the Spark SQL connector, which addresses some of the limitations and inconveniences when working with non-native tables. Teradata recommends that the Foreign Server Library be used to interact with the Spark SQL initiator and all Spark SQL initiator examples in this section are based on the Foreign Server Library. For complete details on the foreign server library, see Foreign Server Library API Reference for the Spark SQL Initiator Connector.

The following steps provide an example of configuring a foreign server in order to use it with a Spark SQL-to-TargetConnector (where TargetConnector is any type of target connector):
  1. Set the link properties for the Spark SQL-to-Teradata link in the QueryGrid portlet. See Spark SQL Connector and Link Properties.
  2. Log on to Scala REPL, see Starting Scala REPL for more information.
  3. Import the Foreign Server Library and create a foreign server object, for example:
    scala> import tdqg.ForeignServer
    import tdqg.ForeignServer
     
    scala> val s1 = new ForeignServer('spark_to_teradata_link',"active","fs1")
    s1: tdqg.ForeignServer = tdqg.ForeignServer@4eb73cc8
  4. Use the foreign server to show remote schemas and verify the results, for example:
    scala> s1.showSchemas
    +---------------+
    |DATABASE_NAME  |
    +---------------+
    |default	|
    |user1		|
    +---------------+