Example: NOS Detects Columns - 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™

In this example, the CREATE FOREIGN TABLE statement specifies no location_column, payload_column, or data_definition_column.

CREATE FOREIGN TABLE Statement

CREATE FOREIGN TABLE riverflow_csv_2,
  EXTERNAL SECURITY MyAuthObj
  USING (
    LOCATION  ('/S3/s3.amazonaws.com/YOUR-BUCKET/CSVDATA/')
  );

SHOW TABLE Statement

SHOW TABLE riverflow_csv_2;

Result:

CREATE MULTISET FOREIGN TABLE NU.riverflow_csv_2 ,FALLBACK ,
     EXTERNAL SECURITY MyAuthObj ,
     MAP = TD_MAP1
     (
      Location VARCHAR(2048) CHARACTER SET UNICODE CASESPECIFIC,
      GageHeight2 DECIMAL(3,2),
      Flow DECIMAL(3,2),
      site_no INTEGER,
      datetime TIMESTAMP(0) FORMAT 'Y4-MM-DDBHH:MI',
      Precipitation DECIMAL(3,2),
      GageHeight DECIMAL(3,2))
USING
(
      LOCATION  ('/S3/YOUR-BUCKET.s3.amazonaws.com/CSVDATA/')
      MANIFEST  ('FALSE')
      PATHPATTERN  ('$CSVDATA/$site_no/$2018/$byteint4/$filename')
      ROWFORMAT  ('{"field_delimiter":",","record_delimiter":"\n","character_set":"LATIN"}')
      STOREDAS  ('TEXTFILE')
      HEADER  ('TRUE')
      STRIP_EXTERIOR_SPACES  ('FALSE')
      STRIP_ENCLOSING_CHAR  ('NONE')
)
NO PRIMARY INDEX ;

SELECT Statement

SELECT GageHeight2, flow, site_no, datetime, Precipitation, GageHeight
  FROM riverflow_csv_2;

Result:

GageHeight2   Flow      site_no          datetime  Precipitation  GageHeight
-----------  -----  -----------  ----------------  -------------  ----------
          ?    .00      9400815  2018-06-29 00:00            .00        -.01
          ?      ?      9429070  2018-07-02 14:35           1.16           ?
          ?    .00      9400815  2018-07-01 00:00            .00        -.01
          ?    .00      9400815  2018-07-02 00:00            .00        -.01
          ?    .00      9400815  2018-07-12 00:00            .00        -.01
          ?    .00      9400815  2018-07-10 00:00            .00        -.01
          ?    .00      9400815  2018-07-09 00:00            .00        -.01
          ?    .00      9400815  2018-07-08 00:00            .00        -.01
          ?    .00      9400815  2018-06-29 00:15            .00        -.01