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.
- To run NOS-related commands, log on to the database as a user with the required privileges.
- Create a foreign table using a custom PATHPATTERN. Use the authorization object created in Controlling Foreign Table Access with an AUTHORIZATION Object:
CREATE FOREIGN TABLE riverflow_json_path , EXTERNAL SECURITY authorization_object USING ( LOCATION ('YOUR-OBJECT-STORE-URI') PATHPATTERN('$data/$siteno/$year/$month/$day') );
See Variable Substitutions for Examples for the credentials and location values for the sample river flow data set.
- Run a query using a payload filter only:
SELECT TOP 2 payload.GageHeight,payload.Flow FROM riverflow_json_path WHERE payload.site_no = '09394500';
TheGageHeight TheFlow ------------- --------- 6.39 45.60 5.04 3.53
- Because the site_no attribute also appears as part of the path, a better way to write this query (that uses path filtering instead of payload filtering) is:
SELECT TOP 2 payload.GageHeight,payload.Flow FROM riverflow_json_path WHERE $path.$siteno = '09394500';
Using path filtering is more efficient. Path filtering reduces the number of external objects read. You can view the query log, if it is enabled, to see that fewer external objects are accessed and less data is transferred with the second query.
For details on the NOS-related DBQL fields, see the Orange Book, Native Object Store: Teradata Vantage™ Advanced SQL Engine, TDN0009800 and Teradata Vantage™ - Data Dictionary, B035-1092.
TheGageHeight TheFlow ------------- --------- 6.40 62.90 6.39 40.1
Note, TOP does not return the same results each time it is run.