Example | APPLY Table Operator | VantageCloud Lake - Example: APPLY Table Operator Function - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Prerequisites

In the following example, the user runs the APPLY table operator query.
.logon youruser
SELECT * FROM APPLY
(
     ON dataset
     RETURNS (prediction_y float);
   USING
     STYLE('csv')
     ENVIRONMENT ('myenvironment')
     APPLY_COMMAND('python myscript.py')
) as dt;

.logoff youruser
  • The user specifies the dataset table as input to the APPLY_COMMAND. The output schema of the table operator is a single float column named "prediction_y".
  • Each AMP in the analytic compute group runs the APPLY_COMMAND with their partition of the "dataset" table.
  • The environment clause specifies the name of the environment created previously. The "youruser" database user must have an environment called "myenvironment".