Skip to main content
Snowflake tasks run SQL against Snowflake from your workflow. Authentication uses Snowflake key-pair authentication. For background on generating keys, assigning the public key to a Snowflake user, and rotation, see Snowflake’s Key-pair authentication and key-pair rotation guide. Install the workflow SDK with the Snowflake extra:

Configure the Snowflake private key

The private key must be available in two places: task pods and the Flyte agent.

Task pods

Create a TrueFoundry secret with group name private-key and key snowflake, and store your Snowflake RSA private key (PEM) as that secret’s value. See Manage secrets for how to create secrets in TrueFoundry. Reference the secret in task mounts using its FQN, for example: tfy-secret://truefoundry:private-key:snowflake Mount it on any @task that uses Snowflake StructuredDataset URIs (see the example below).

Flyte agent

For the Flyte agent, create and use a TrueFoundry secret for the Snowflake private key, then wire that secret into the Flyte agent secret via kustomize. Set Flyte agent values:
Then add/update the following in kustomize:

SnowflakeTaskConfig

str
required
Snowflake user name (the user whose RSA public key is registered in Snowflake).
str
required
Snowflake account identifier (for example the value in your account URL).
str
required
Default Snowflake database for the task.
str
required
Default Snowflake schema for the task.
str
required
Snowflake warehouse to use for the session.

SnowflakeTask

Define a Snowflake task with a SQL query template and task config.

Example

This workflow runs a select, prints the result, inserts a row, writes a small table via a Python task using a Snowflake StructuredDataset URI, and runs another select.

Checklist

  • Configure key-pair authentication in Snowflake and store the private key securely; see Snowflake key-pair authentication.
  • Create a TrueFoundry secret with group private-key and key snowflake, and mount it using an FQN such as tfy-secret://truefoundry:private-key:snowflake (see Manage secrets).
  • Enable flyteagent, set agentSecret.secretData.secretData: {} in values, and provide snowflake_private_key: tfy-secret://internal:private-key:snowflake via a kustomize Secret named flyteagent.
  • Install truefoundry[workflow,snowflake] and use SnowflakeTask + SnowflakeTaskConfig for SQL; mount the private key on Python tasks that use Snowflake StructuredDataset URIs.