Executing Scripts - Advanced SQL Engine - Teradata Database

SQL Operators and User-Defined Functions

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
Published
September 2020
Language
English (United States)
Last Update
2023-04-27
dita:mapPath
qqu1556127655717.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1210
lifecycle
previous
Product Category
Teradata Vantage™

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:.