SQL Execute
Executes a user-defined SQL clause.
Information at a Glance
Parameter |
Description |
---|---|
Category | Tools |
Data source type | DB |
Send output to other operators | Yes |
Data processing tool | n/a |
The SQL statement executed inside this operator does not have any dependency on its preceding or succeeding operator.
The connection only ensures its execution sequence within the analytic workflow.
The SQL Execute code can invoke any well-formed SQL statement, including stored procedures and in-database languages (for example, PL/R in PostgreSQL).
When used with a Google Big Query data source, the SQL Execute operator treats any line beginning with "-" or "#" to be a comment line and does not submit them for execution.
You can run temporary functions in Google Big Query using SQL Execute. For example:
Next line is expected to be the first query for udf definition to work. CREATE TEMP FUNCTION multiplyInputs(x FLOAT64, y FLOAT64) RETURNS FLOAT64 LANGUAGE js AS """ return x*y; """; WITH `datascience.credit` AS (SELECT 1 AS x, 3 as y UNION ALL SELECT 4 AS x, 5 as y) SELECT x, y, multiplyInputs(x, y) as product FROM `datascience.credit`;
Input
The SQL Execute operator does not require any input, but can be connected to a data set output.
Configuration
Parameter | Description |
---|---|
Notes | Notes or helpful information about this operator's parameter settings. When you enter content in the Notes field, a yellow asterisk appears on the operator. |
Data Source | Select from the list of the data sources connected to the operator (optional).
If not specified, the SQL Execute operator gets a database connection from the preceding operator. You can select a different connection for the operator, but this selection cannot be passed to a succeeding operator. |
SQL Clause |
Click Define Clause to open the Define SQL Statement dialog dialog and define the SQL to run. |
Pass Output Table | Specify whether to pass the SQL Execute output to the next operator.
If Yes, the Result Table Structure details must be configured. Set this option to Yes to send the SQL Execute operator output to the next operator. If SQL Execute is a terminal operator, this setting is not required. Default value: No. |
Result Table Structure | Displays the
Edit Table Columns dialog, where you can specify the table structure of the operator's output to pass to the next operator.
Specifying the table structure dynamically pulls the values from the alpine_sql_output variable in the SQL script. The controls that contain the values are not populated until you run the SQL script once. The button to specify the result table structure is enabled only if Pass Output File is set to Yes. |
Output Schema | The schema for the output table or view. |
Output Table | Specify the table path and name where the output of the results is generated. By default, this is a unique table name based on your user ID, workflow ID, and operator. |
Drop If Exists | Specifies whether to overwrite an existing table.
|