Load JSON Data Using READ_NOS | Native Object Store ( NOS ) | Teradata Vantage - Loading External Data into the Database Using READ_NOS and CREATE TABLE AS - Advanced SQL Engine - Teradata Database

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

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Published
January 2021
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
zws1595641486108.ditamap
dita:ditavalPath
hoy1596145193032.ditaval
dita:id
B035-1214
lifecycle
previous
Product Category
Software
Teradata Vantage
READ_NOS combined with a CREATE TABLE AS clause accesses data from the object store and creates a permanent table for the data inside the database, without needing to create a foreign table first.

In this example, all the data in the object store identified by the LOCATION is loaded into the database. This allows the columns to be referenced without using DOT notation and allows you to cast the fields to appropriate data types.

The examples and results show a sample river flow data set. To use your own data, replace the table and column names, and authorization object.

  1. To run NOS-related commands, log on to the database as a user with the required privileges.
  2. Create and load the table:
    CREATE MULTISET TABLE riverflowperm_json AS
    (
    SELECT
    CAST(payload.site_no AS CHAR(8)) Site_no,
    CAST(payload.Flow AS FLOAT) ( FORMAT '-ZZZ9.99') Flow,
    CAST(payload.GageHeight AS FLOAT) ( FORMAT '-ZZZ9.99') GageHeight1,
    CAST(payload.Precipitation AS FLOAT) ( FORMAT '-ZZZ9.99') Precipitation,
    CAST(payload.Temp AS FLOAT) ( FORMAT '-ZZZ9.99') Temperature,
    CAST(payload.Velocity AS FLOAT) ( FORMAT '-ZZZ9.99') Velocity
    FROM READ_NOS_FM (
    ON (SELECT CAST(NULL AS JSON))
    USING
    LOCATION('YOUR-STORAGE-ACCOUNT')
    ) AS D
    ) WITH DATA;

    See Variable Substitutions for Examples for the credentials and location values for the sample river flow data set.

  3. Find out how many rows are in the table:
    SELECT COUNT(*) FROM riverflowperm_json;

    Result:

    Count(*)
    -----------
          36301