16.20 - Executing Scripts - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Operators and User-Defined Functions

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Administration
Programming Reference
Publication ID
B035-1210-162K
Language
English (United States)

The SCRIPT table operator runs once per AMP by default. If a PARTITION BY clause is used on the input data, SCRIPT is executed once per partition.

An 'export PATH;' is prepended to whatever you run using the SCRIPT Table Operator. When the bash process spawns a child, the child has the PATH as part of its environment.

The table operator executes scripts under tdatuser by default, so PATH refers to the tdatuser's PATH environment variable. With the AUTH feature, you control which operating system user to execute under the SCRIPT table operator. Generally, the operating system user specified in the SCRIPT table operator's AUTH clause has already exported the PATH environment variable.

Example: Reading the PATH Variable without Setting It

SELECT * from SCRIPT(script_command('echo $PATH;') returns ('PATH varchar(512)'));
 
PATH
---------------------------------------------------------------------------
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:.
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:.
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:.
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:.