Summary: ◀▼
You can connect action flows to Snowflake using OAuth 2.0 authentication to automate workflows involving SQL queries, table searches, and schema lookups. Use a dedicated service account for secure integration. Available actions let you execute SQL statements, find tables with pattern filters, and retrieve detailed table schema information, helping you manage data and automate tasks across platforms effectively.
Connecting Snowflake to action builder
Before you can include external actions in your action flows, you must connect the action builder to the external system.
- All external actions performed by an action flow are attributed to the user who connected the external system. Therefore, it's a best practice to use a dedicated service account rather than personal credentials when connecting to each external system.
- All integrations request access to necessary scopes. However, it's important that you review and validate the scopes before authorizing the connection to the external system.
- When managing credentials for API key-based tools, such as OpenAI, it's best to store keys in a secure vault or credential manager.
The Snowflake connection uses OAuth 2.0 authentication with the authorization code grant type. You will need to provide three pieces of information:
-
Account Identifier: Your Snowflake account identifier (for example, APAC_DEV.AWS_AP_NORTHEAST_1)
-
OAuth Client ID: OAuth client ID from your Snowflake security integration
-
OAuth Client Secret: OAuth client secret from your Snowflake security integration
To set up OAuth authentication in Snowflake
- Create a security integration in Snowflake with OAuth settings.
- Generate the client ID and client secret credentials.
- Configure the appropriate redirect URIs for action flows.
- In Admin Center, click
Apps and integrations in the sidebar, then select Actions > Action
flows. - Create or edit an action flow.
- Open the step sidebar.
- Under External actions, click Snowflake.
- Click Connect.
- Follow Snowflake's prompts to authenticate and complete the connection.
The connector uses the
refresh_tokenscope during authentication. Role and warehouse are specified per action at execution time, providing flexibility to choose appropriate resources based on workload needs.Review the requested permissions carefully before authorizing the connection. Keep your client secret secure and do not share it or commit it to version control.
Note: All external actions performed by an action flow are attributed to the user who connected the external system. Therefore, it is a best practice to use a dedicated service account rather than personal credentials when connecting to each external system.
After you've connected to the system, you'll see an indicator that it's connected and details about the instance you're connected to, as well as the actions available for Snowflake.
Using Snowflake actions in action flows
Executing a query
Use the Execute query action to run arbitrary SQL statements in Snowflake.
This action has the following inputs and outputs:
| Variables | |
|---|---|
| Inputs | Required: SQL statement,
Warehouse,
RoleOptional:
Consider the
following when using the Execute query action:
|
| Output | Query execution results including statement handle, status URL, execution message, row count, rows affected, and data array for SELECT queries. |
Searching tables
Use the Search tables action to discover tables in a Snowflake database schema with optional pattern filtering.
This action has the following inputs and outputs:
| Variables | |
|---|---|
| Inputs | Required: Database,
Schema, Warehouse,
RoleOptional: Consider the following when
using the Search tables action:
|
| Output | Array of table objects containing name, kind, row count,
byte size, and creation date, along with total count. The kind field indicates the table type (TABLE, VIEW, etc.). |
Looking up a table schema
Use the Lookup table schema action to retrieve column definitions and metadata for a specific Snowflake table.
This action has the following inputs and outputs:
| Variables | |
|---|---|
| Inputs | Required: Database,
Schema, Table,
Warehouse,
RoleConsider the following when
using the Lookup table schema action:
|
| Output | Array of column objects containing name, data type,
nullable status, default value, and primary key indicator,
along with array of primary key column names. The column output includes data type information (for example, VARCHAR, NUMBER, DATE), whether each column accepts null values, default values if defined, and whether the column is part of the primary key. The primary keys field provides a separate list of all primary key column names for convenience. |