Use INSERT SELECT to Load Parquet | Native Object Store ( NOS ) | Teradata Vantage - 17.00 - Loading External Data into the Database Using INSERT SELECT - Teradata Database

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

prodname
Advanced SQL Engine
Teradata Database
vrm_release
17.00
created_date
September 2020
category
Programming Reference
featnum
B035-1214-170K

This example illustrates how a subset of the attributes for a single siteno value can be stored in a persistent database table using an INSERT SELECT statement.

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. In this example, data from a single site number is loaded into the database. Create the permanent table to store the external data:
    CREATE TABLE RiverFlowPermInsert_parquet
    (DateTS CHAR(20)
    ,SiteNo CHAR(8)
    ,Flow FLOAT FORMAT '-ZZZZ9.99'
    ,GageHeight FLOAT FORMAT '-ZZZ9.99'
    ,Precipitation FLOAT FORMAT '-ZZZ9.99')
    PRIMARY INDEX (SiteNo);
  4. Insert the external data into the database table:
    INSERT INTO RiverFlowPermInsert_parquet
    SELECT datetime
    ,CAST (site_no AS CHAR(8))
    ,CAST (Flow AS FLOAT)
    ,CAST (GageHeight AS FLOAT)
    ,CAST (Precipitation AS FLOAT)
    WHERE site_no='09394500'
    FROM riverflow_parquet;
  5. Query the data from the database table:
    SELECT TOP 2 * FROM RiverFlowPermInsert_parquet;
    

    Result:

    DateTS                SiteNo         Flow  GageHeight  Precipitation
    --------------------  --------  ---------  ----------  -------------
    2018-07-12 01:00      9394500        4.84        5.13           0.00
    2018-07-12 00:30      9394500        4.84        5.13           0.00