Load External Parquet Data | Native Object Store ( NOS ) | Teradata Vantage - Loading External Data into the Database Using CREATE TABLE AS...WITH DATA - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - Native Object Store Getting Started Guide

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
jjn1567647976698.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1214
lifecycle
previous
Product Category
Software
Teradata Vantage

If you access the same external data often, copy the data inside the database. To do this, copy the table definitions and data from the existing foreign table to a new target table inside the database using a CREATE TABLE AS ...WITH DATA command.

The examples use a sample river flow data set. To use your own data, replace the table and column names, and authorization object. See Variable Substitutions for Examples for the credentials and location values for the sample data set.

  1. To run NOS-related commands, log on to the database as a user with the required privileges.
  2. If it does not exist, create the foreign table or ask your database administrator to create the foreign table called riverflow_parquet. See Setting Up to Run Parquet Examples.
  3. Create a table in the database to load a subset of the external data that you are interested in analyzing:
    CREATE MULTISET TABLE riverflowprecip_parquet AS (
      SELECT CAST(site_no AS CHAR(8)) SiteNo,
             CAST(Flow AS FLOAT) ( FORMAT '-ZZZZ9.99') Flow,
             CAST(GageHeight AS FLOAT) ( FORMAT '-(3)ZZ9.99') GageHeight,
             CAST(datetime AS TIMESTAMP(0) FORMAT 'YYYY-MM-DDBHH:MI') Date_Time
        FROM riverflow_parquet
       WHERE Precipitation > 0
    ) WITH DATA
    NO PRIMARY INDEX;
  4. Display the number of rows in the table:
    SELECT COUNT(*) FROM riverflowprecip_parquet;

    Result:

    Count(*)
    --------
         155