Use DATASET_KEYS to See Headers | Native Object Store ( NOS ) | Teradata Vantage - 17.00 - Using DATASET_KEYS to See Header Names - 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

View the external data header names using the DATASET_KEYS function to display the keys.

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. See Setting Up to Run CSV Examples.
  3. Run the DATASET_KEYS function to display the names of all attributes contained within the payloads of the CSV objects being accessed by the foreign table called riverflow_csv. Once these attributes have been displayed, any of them can be specified within an SQL statement SELECT clause to display values, or in the WHERE clause to limit which records are returned for viewing:
    SELECT DISTINCT * FROM DATASET_KEYS (ON (SELECT payload FROM riverflow_csv)) AS
    csvKeys;

    Your result will be similar to the following:

    DatasetKeys
    -----------------
    Precipitation
    BatteryVoltage
    Temp
    Velocity
    Conductance
    WaterVelocity
    site_no
    GageHeight
    Flow
    GageHeight2
    datetime

    The results are different from the results of SELECT TOP N because not all records contain all of the attributes, so TOP N may return records with only a subset of the attributes.

    If you have multiple files in your location with different headers, all headers from all resulting files appear.