Using WRITE_NOS with AUTHORIZATION | NOS | Teradata Vantage - Example: Using WRITE_NOS with AUTHORIZATION - 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

The example uses the AUTHORIZATION keyword to provide credentials to external object store. Instead of creating an authorization object and a function mapping, you can include your credentials in the WRITE_NOS command itself.

    Prerequisites

  1. If not already done, set up a database table to extract data from. You can use one of your existing tables or set up a test table to use with the examples. See Setting Up a Test Table.
  2. Set up or obtain access to the external object store where you want to write data. Follow the instructions from your external storage vendor.
  3. Use AUTHORIZATION Keyword

  4. Use WRITE_NOS with the AUTHORIZATION keyword:
    SELECT NodeId, AmpId, Sequence, ObjectName, ObjectSize, RecordCount
    FROM WRITE_NOS (
    ON ( SELECT * FROM RiverFlowPerm WHERE DateTime = (TIMESTAMP '2018-07-01 00:00:00') )
    USING
      LOCATION('YOUR-STORAGE-ACCOUNT/20180701_auth_example/')
      AUTHORIZATION('{"Access_ID":"YOUR-ACCESS-KEY-ID",
                      "Access_Key":"YOUR-SECRET-ACCESS-KEY"}')
      STOREDAS('PARQUET')
    ) AS d
    ORDER BY AmpId;

    Replace LOCATION with the URI to the external object store where you are writing the data. Replace YOUR-ACCESS-KEY-ID and YOUR-SECRET-ACCESS-KEY with credentials to your external object store.

    Your result will be similar to the following:

    NodeId AmpId Sequence ObjectName
    ------ ----- -------- ------------------------------------------------------------------------
        33     0        1 /S3/s3.amazonaws.com/ie-writenos-bucket/20180701_auth_example/object_33_0_1.parquet
        33     1        1 /S3/s3.amazonaws.com/ie-writenos-bucket/20180701_auth_example/object_33_1_1.parquet
        33     2        1 /S3/s3.amazonaws.com/ie-writenos-bucket/20180701_auth_example/object_33_2_1.parquet