Table: snowflake_session_policy - Query Snowflake Session Policies using SQL
A Snowflake Session Policy is a feature in Snowflake that allows users to define and enforce specific settings or behaviors for a user session. These policies can include setting the time zone, date and time formats, and other session parameters. Snowflake Session Policies help in maintaining consistency and control over user sessions.
Table Usage Guide
The snowflake_session_policy
table provides insights into session policies within Snowflake. As a database administrator, explore specific details about each session policy, including its name, comment, and the values of the parameters it sets. Utilize it to uncover information about session policies, such as their current state, and the specific settings or behaviors they enforce.
Examples
Basic info
Identify the policies regarding session timeouts within your Snowflake environment. This can help manage idle sessions and optimize resource usage.
select name, database_name, schema_name, session_idle_timeout_mins, session_ui_idle_timeout_minsfrom snowflake_session_policy;
select name, database_name, schema_name, session_idle_timeout_mins, session_ui_idle_timeout_minsfrom snowflake_session_policy;
List policies with idle timeout more than an hour
Explore the policies that have an idle timeout exceeding one hour. This query can be useful in identifying potential areas for improved resource allocation and efficiency.
select name, database_name, schema_name, session_idle_timeout_mins, session_ui_idle_timeout_minsfrom snowflake_session_policywhere session_idle_timeout_mins > 60 or session_ui_idle_timeout_mins > 60;
select name, database_name, schema_name, session_idle_timeout_mins, session_ui_idle_timeout_minsfrom snowflake_session_policywhere session_idle_timeout_mins > 60 or session_ui_idle_timeout_mins > 60;
Schema for snowflake_session_policy
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account | text | =, !=, ~~, ~~*, !~~, !~~* | The Snowflake account ID. |
comment | text | Comment for this policy. | |
created_on | timestamp with time zone | Date and time of the creation of session policy. | |
database_name | text | Name of the database policy belongs. | |
kind | text | Type of the snowflake policy. | |
name | text | Identifier for the session policy. | |
owner | text | Name of the role that owns the policy. | |
region | text | The Snowflake region in which the account is located. | |
schema_name | text | Name of the schema in database policy belongs. | |
session_idle_timeout_mins | bigint | Time period in minutes of inactivity with either the web interface or a programmatic client. | |
session_ui_idle_timeout_mins | bigint | Time period in minutes of inactivity with the web interface. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- snowflake
You can pass the configuration to the command with the --config
argument:
steampipe_export_snowflake --config '<your_config>' snowflake_session_policy