Example: Specifying a Definer Authorization for a Foreign Table - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Published
January 2021
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
ncd1596241368722.ditamap
dita:ditavalPath
hoy1596145193032.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

In this example, an authorization with definer trusted credentials is associated with a foreign table. You can share the authorization object with multiple users.

This statement creates an authorization DefAuth_S3 with definer trusted credentials. See CREATE AUTHORIZATION and REPLACE AUTHORIZATION.

CREATE AUTHORIZATION DefAuth_S3
AS DEFINER TRUSTED
    USER 'YOUR-ACCESS-KEY-ID'
    PASSWORD 'YOUR-SECRET-ACCESS-KEY';

This statement creates the foreign table sensordata2 and specifies the authorization DefAuth_S3.

CREATE FOREIGN TABLE sensordata2, 
 EXTERNAL SECURITY DEFINER TRUSTED DefAuth_S3
USING ( 
       LOCATION (' /s3/YOUR-BUCKET.s3.amazonaws.com/') 
      );