Example: Object Paths without 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 do not include variables. The CREATE FOREIGN TABLE statement omits PATHPATTERN, so it must include PARTITION BY. Vantage generates PATHPATTERN and PARTITION BY, using the PARTITION BY column names as PATHPATTERN variable names.

Paths to Foreign Table Objects

/S3/s3.amazonaws.com/sv186025-crimedata-no-vcol-pq/ny/2014/Apr/Day7.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-no-vcol-pq/ny/2014/Mar/Day6.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-no-vcol-pq/sf/2018/Nov/Day27.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-no-vcol-pq/sf/2017/Oct/Day21.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-no-vcol-pq/sf/2017/Oct/Day24.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-no-vcol-pq/ny/2014/Mar/Day9.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-no-vcol-pq/sf/2018/Dec/Day30.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-no-vcol-pq/sf/2019/Jan/Day11.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-no-vcol-pq/ny/2015/May/Day12.parquet
/S3/s3.amazonaws.com/sv186025-crimedata-no-vcol-pq/sf/2016/Aug/Day18.parquet

CREATE FOREIGN TABLE Statement

CREATE MULTISET FOREIGN TABLE CRIMEDATA,
  EXTERNAL SECURITY DEFINER TRUSTED S3
  USING (
    LOCATION ('/s3/s3.amazonaws.com/sv186025-crimedata-no-vcol-pq/')
  )
  PARTITION BY (COLUMN, CITY VARCHAR(2), Year_x BIGINT, Month_x VARCHAR(3));

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-no-vcol-pq/')
      MANIFEST ('FALSE')
      PATHPATTERN ('$CITY/$Year_x/$Month_x/$var4')
      STOREDAS ('PARQUET')
)
NO PRIMARY INDEX

PARTITION BY (COLUMN, CITY VARCHAR(2), Year_x BIGINT, Month_x VARCHAR(3));