17.10 - Running Examples Without an Authorization Object - 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)

If you want to test examples or test that your credentials work without creating an authorization object, you can use your access id and key in plain text in the command. Include your credentials in the USING clause of the READ_NOS statement in the ACCESS_ID and ACCESS_KEY keywords.

For example:

SELECT TOP 2 location(CHAR(100)), ObjectLength FROM READ_NOS (
USING
LOCATION ('YOUR-OBJECT-STORE-URI')
ACCESS_ID ('YOUR-ACCESS-KEY-ID')
ACCESS_KEY ('YOUR-SECRET-ACCESS-KEY')
RETURNTYPE ('NOSREAD_KEYS')
)
AS d;

Replace YOUR-OBJECT-STORE-URI, YOUR-ACCESS-KEY-ID, and YOUR-SECRET-ACCESS-KEY to access your own external storage and test that your credentials work. For information, see Variable Substitutions for Examples.

For public buckets, ACCESS_ID and ACCESS_KEY are empty strings.

ObjectLength is the size of the external files in the specified LOCATION of the object store.

By default, the RETURNTYPE is NOSREAD_KEYS, which retrieves a list of files from the path specified by LOCATION. You do not need to specify the RETURNTYPE parameter if you want the default behavior.

Example: Running Examples Without an Authorization Object

The following example shows the READ_NOS statement without an authorization object. It accesses a Teradata-supplied public bucket.

For example:

SELECT TOP 2 * FROM (
LOCATION='/s3/td-usgs-public.s3.amazonaws.com/CSVDATA/'
ACCESS_ID=''
ACCESS_KEY=''
RETURNTYPE='NOSREASD_KEYS'
) AS d;

This example returns one row for each external file. The result lists the object length and location of each file.

For public buckets, ACCESS_ID and ACCESS_KEY are empty strings. If your bucket or container is not public, include the credentials inside the single quotes for each variable.

ObjectLength is the size of the external files in the specified LOCATION of the object store.