Load External JSON Data | Native Object Store ( NOS ) | Teradata Vantage - 17.10 - 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

Advanced SQL Engine
Teradata Database
Release Number
Release Date
July 2021
Content Type
Programming Reference
Publication ID
English (United States)

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. CREATE TABLE AS … WITH DATA creates a table with two columns: Location and Payload.

Teradata recommends that you break out the payload attributes as individual columns. This allows the columns to be referenced without using DOT notation and allows you to cast the fields to appropriate data types.

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_json. See Setting Up to Run JSON 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_json(site_no,flow,gageheight,datetime) AS (
    SELECT payload.site_no, payload.Flow, payload.GageHeight, payload.datetime
    FROM riverflow_json
    WHERE payload.Precipitation > 0
  4. Display the number of rows in the table:
    SELECT COUNT(*) FROM riverflowprecip_json;