Jeff SkoldbergFriday, January 24, 2025
In Snowflake, a Secret is a schema level object that allows you to store sensitive information such as API Keys or Passwords.
Recently, Snowflake has rolled out many features that enable more application and data pipeline development directly inside of Snowflake:
All of these use cases require storing and accessing secrets to authenticate to various applications and services.
grant usage on secret to role <role>
).There are 4 types of secrets that can be created in Snowflake and the DDL varies slightly by type.
Syntax
Example
Syntax:
Example:
Syntax:
Example:
Syntax:
Example:
Secrets can be fetched using Java or Python only. If you are hosting an application in Snowpark Container Services using another programming language, you will need a small custom module in Java or Python to fetch the secret, then pass the value back to your application.
Here is an example to fetch a secret using Python.
Snowflake provides a user friendly way to pass a secret to Notification Integrations for purposes of sending alerts to webhooks (Slack, Microsoft Teams, etc.)
Simply pass the fully qualified database.schema.<secret_name>
to the WEBHOOK_SECRET
argument of the create notification integration
statement. For example:
You can show all secrets using the show secrets
command.
You can delete a secret using the drop
command:
Alter secret is used to rotate keys or passwords, or alter any other aspect of the secret.
Describing a secret using describe secret <fully qualified secret name>
will return the following fields:
Managing secrets directly in Snowflake is a powerful way to streamline the use of sensitive information when developing applications, pipelines, or alerts in Snowflake.
In the next article, we will put this knowledge into action by creating a Slack alert in Snowflake.
Jeff Skoldberg is a Sales Engineer at SELECT, helping customers get maximum value out of the SELECT app to reduce their Snowflake spend. Prior to joining SELECT, Jeff was a Data and Analytics Consultant with 15+ years experience in automating insights and using data to control business processes. From a technology standpoint, he specializes in Snowflake + dbt + Tableau. From a business topic standpoint, he has experience in Public Utility, Clinical Trials, Publishing, CPG, and Manufacturing.
Want to hear about our latest Snowflake learnings?Subscribe to get notified.
Connect your Snowflake account and instantly understand your savings potential.