Example: Object Paths with Variable Names - Analytics Database - Teradata Vantage

SQL Data Definition Language Syntax and Examples

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
jco1628111346878.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
mdr1472255012272
lifecycle
latest
Product Category
Teradata Vantage™

The paths to the foreign table objects include variables, so the CREATE FOREIGN TABLE statement can omit PATHPATTERN and PARTITION BY. Vantage generates PATHPATTERN and PARTITION BY, using the variables in the paths as partition column names and PATHPATTERN variable names.

Paths to Foreign Table Objects

Variables are bold.
/S3/s3.amazonaws.com/sv186025-crimedata-vcol-pq/city=sf/year_x=2017/month_x=Oct/Day21.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-vcol-pq/city=ny/year_x=2015/month_x=May/Day12.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-vcol-pq/city=ny/year_x=2014month_x=Mar/Day8.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-vcol-pq/city=sf/year_x=2019/month_x=Jan/Day14.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-vcol-pq/city=sf/year_x=2017/month_x=Sep/Day21.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-vcol-pq/city=ny/year_x=2014/month_x=Apr/Day6.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-vcol-pq/city=ny/year_x=2013/month_x=Jan/Day4.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-vcol-pq/city=ny/year_x=2013/month_x=Feb/Day3.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-vcol-pq/city=ny/year_x=2015/month_x=Jun/Day12.parquet

CREATE FOREIGN TABLE Statement

CREATE MULTISET FOREIGN TABLE CRIMEDATA,
  EXTERNAL SECURITY DEFINER TRUSTED S3
  USING (
    LOCATION ('/s3/s3.amazonaws.com/sv186025-crimedata-vcol-pq/')
  );

SHOW TABLE Output

CREATE MULTISET FOREIGN TABLE CRIMEDATA, FALLBACK,
     EXTERNAL SECURITY DEFINER TRUSTED S3_AUTH,
     MAP = TD_MAP1
     (
      Location VARCHAR(2048) CHARACTER SET UNICODE CASESPECIFIC,
      "index" BIGINT,
      ID_Number BIGINT,
      Case_Number VARCHAR(8) CHARACTER SET UNICODE NOT CASESPECIFIC,
      Year_x BIGINT,
      Month_x VARCHAR(3) CHARACTER SET UNICODE NOT CASESPECIFIC,
      Day_x BIGINT,
      Arrest BYTEINT,
      District FLOAT)
USING
(
      LOCATION ('/s3/s3.amazonaws.com/sv186025-crimedata-vcol-pq/')
      MANIFEST ('FALSE')
      PATHPATTERN ('$city/$year_x/$month_x/$var4')
      STOREDAS ('PARQUET')
)
NO PRIMARY INDEX
PARTITION BY (COLUMN, city CHAR(2), Year_x BIGINT, Month_x VARCHAR(3));