Executing Scripts - Analytics Database - Teradata Vantage

SQL Operators and User-Defined Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-04-05
dita:mapPath
xub1628111590556.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
drp1544241916620
lifecycle
latest
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)'));

Result:

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