Execute an SQL statement and store the result in Grail with the Snowflake for Workflows actions.
Action
Description
Execute statement
It executes a single SQL statement on your Snowflake database.
Store Statement Result
It executes the provided statement and then stores its result directly in Grail without presenting them as the action's result.
The Execute Statement action of Snowflake for Workflows allows you to execute a single SQL statement on your Snowflake database. It will return the statement's result as the action's result, including data and header information.
To execute a single SQL statement in your workflow, you need to provide the information listed below.
As a result, only the first partition of the data returned by Snowflake will be returned, to avoid reaching the maximum result size of Workflow Actions. We recommend using this action to execute statements with smaller results.
The recommended way of making dynamic statements is to use Snowflake bind variables.
The action supports both ?
placeholders and named parameters.
For each parameter, you need to specify the name, type, and value.
For the ?
placeholders, the name of the parameter is the order in which they appear, so the first ?
has the name 1
, the second one will be named 2
.
The Execute Statement action result is the direct response from executing the Snowflake REST API. For more information, see Snowflake ResultSet.
The most important fields are:
Property
Description
resultSetMetaData
Contains the meta-information about the data, including header names and types.
data
An array containing rows with the data results from executing the statement. Each row contains columns represented as a list of values.
This result can be used as input for other workflow actions via workflow expressions.
The result of the action can contain sensitive data. If you need to work with data that not everybody should see, consider making the workflow private.
The Store Statement Result action of Snowflake for Workflows application executes the provided statement and then stores its result directly in Grail without presenting them as the action's result. Every row will be stored as a separate BizEvent, with column names from Snowflake being bizevent's fields. This action loads all data partitions returned by Snowflake.
To store the statement result in Grail using your workflow, you need to provide the information listed below.
After executing the statement on Snowflake, the result will be automatically mapped to bizevent and ingested into Grail - every data row will create one bizevent.
All column names from SQL statements will become bizevent fields, for example:
SELECT 'my value 1' as column_1, 'my value 2' as column_2
Will result in bizevent having fields:
{ "column_1": "my value 1", "column_2": "my value 2" }
To avoid issues with the ingestion, long column names, duplicated names, or names containing whitespaces or special characters will be converted automatically. Add the as YOUR_COLUMN_NAME
to every column in your statement to ensure predictable bizevent field names.
The data will be automatically mapped from Snowflake types to Grail-supported types.
All data and time columns will be presented as a timezone timestamp string with nanosecond resolution (for example, 2024-05-14T11:40:33.952000000+02:00
).
Each bizevent will contain additional meta-data fields: requestId
, which includes the unique UUID string generated for the execution, event.provider
; and event.type
. Those fields cannot be overwritten.
The Store Statement Result action provides the following output:
Property
Description
count
The number of bizevents that were ingested
chunks
Diagnostic information on the number of chunks of bizevents was created to avoid loading them all at once.
eventMetadata
A JSON object containing fields (requestId
, event.type
, event.provider
) that were added to every ingested bizevent. The requestId
is unique for each execution and can be used to search for bizevents or to find related logs on Snowflake.