Basic Foreign Table View for CSV | Native Object Store ( NOS ) | Teradata Vantage - 17.10 - Creating a Basic View - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - Native Object Store Getting Started Guide

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1214-171K
Language
English (United States)

Creating a view allows you to:

  • CAST the payload fields to an appropriate data type.
  • Rename the header fields using case insensitive naming. Although the example shows the headers in mixed case, you can use whatever case you want in queries.

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_csv_pathfilter: See Filtering Using a Column Within the Data Set.
  3. Create the view on the foreign table:
    CREATE VIEW riverflowview_csv AS (
    SELECT
    Flow,
    GageHeight,
    Precipitation,
    Temp,
    Conductance,
    Site_no
    FROM riverflow_csv_pathfilter );
  4. Query the view:
    SELECT TOP 2 * FROM riverflowview_csv;

    Your result will be similar to the following:

    Flow    GageHeight Precipitation Temperature Conductance site_no 
    ------  ---------- ------------- ----------- ----------- -------------- 
    17500        10.21           .00         11.0        670        9380000       
    17700        10.25           .00         11.2        671        9380000 

    Columns with missing attributes return NULLs when the record does not contain the attribute.