Snowflake for Workflows actions

Preview release

Snowflake for Workflows is currently in preview release and is available to selected customers only. If you would like to share feedback or ideas, join the preview by signing up via the Request access to Snowflake Workflow Connector form or contacting your Customer Success Manager.

For more information, see preview releases.

After you join the preview program for Snowflake for Workflows, we'll provide Hub subscription details. With those subscription details, follow the Add Hub subscriptions procedure to you activate the capability.

Execute a 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.

Execute statement action

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. The action will only return the first partition of the data returned by Snowflake, to avoid reaching the maximum result size of workflow actions. We recommend using this action to execute statements with smaller results.

To execute a single SQL statement in your workflow, you need to provide the information listed below.

Field
Description
Required
Connection
A preconfigured Snowflake connection.
required
Query
The SQL statement.
required
Binding parameters
Binding parameters for the statement. More information is in the Dynamic statements section.
optional
Database
The default database used by the statement.
optional
Schema
The default database schema used by the statement.
optional
Snowflake warehouse
The Snowflake warehouse used to execute the statement.
optional
Database role
The Snowflake role used to execute the statement.
optional
Timeout (in seconds)
The maximum execution time for the statement on the Snowflake.
optional

Dynamic statements

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.

Result

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.

Store the statement result in Grail action

The Store Statement Result action in Snowflake for Workflows executes the provided statement and then stores its result directly in Grail without presenting the Snowflake response as the action's result. Every row is stored as a separate BizEvent, and the bizevent fields are taken from the Snowflake column names. 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.

Field
Description
Required
Connection
A preconfigured Snowflake connection.
required
Query
The SQL statement.
required
Binding parameters
Binding parameters for the statement. More information is in the Dynamic statements section.
optional
Database
The default database used by the statement.
optional
Schema
The default database schema used by the statement.
optional
Snowflake warehouse
The Snowflake warehouse used to execute the statement.
optional
Database role
The Snowflake role used to execute the statement.
optional
Timeout (in seconds)
The maximum execution time for the statement on the Snowflake.
optional

Ingesting data into Grail

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.

Storing the data as bizevents in Grail might introduce additional costs, depending on how many records and how many columns were ingested. You can find more information about transparent per-GiB costs on the Dynatrace pricing page.

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

Result

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.