SHOW SNAPSHOT POLICIES¶
Lists all the snapshot policies in your account for which you have access privileges.
Syntax¶
SHOW SNAPSHOT POLICIES
[ LIKE '<pattern>' ]
[ IN { ACCOUNT | DATABASE | DATABASE <db_name> | SCHEMA | SCHEMA <schema_name> } ]
Parameters¶
LIKE 'pattern'
Optionally filters the command output by object name. The filter uses case-insensitive pattern matching, with support for SQL wildcard characters (
%
and_
).For example, the following patterns return the same results:
... LIKE '%testing%' ...
... LIKE '%TESTING%' ...
. Default: No value (no filtering is applied to the output).
[ IN { ACCOUNT | DATABASE | DATABASE db_name | SCHEMA | SCHEMA schema_name } ]
If you specify the keyword
ACCOUNT
, then the command retrieves records for all schemas in all databases of the current account.If you specify the keyword
DATABASE
, then:If you specify a
db_name
, then the command retrieves records for all schemas of the specified database.If you don’t specify a
db_name
, then:If there is a current database, then the command retrieves records for all schemas in the current database.
If there is no current database, then the command retrieves records for all databases and schemas in the account.
If you specify the keyword
SCHEMA
, then:If you specify a qualified schema name (for example,
my_database.my_schema
), then the command retrieves records for the specified database and schema.If you specify an unqualified
schema_name
, then:If there is a current database, then the command retrieves records for the specified schema in the current database.
If there is no current database, then the command displays the error
SQL compilation error: Object does not exist, or operation cannot be performed
.
If you don’t specify a
schema_name
, then:If there is a current database, then:
If there is a current schema, then the command retrieves records for the current schema in the current database.
If there is no current schema, then the command retrieves records for all schemas in the current database.
If there is no current database, then the command retrieves records for all databases and all schemas in the account.
Usage notes¶
The command returns a maximum of ten thousand records for the specified object type, as dictated by the access privileges for the role used to execute the command. Any records above the ten thousand records limit aren’t returned, even with a filter applied.
To view results for which more than ten thousand records exist, query the corresponding view (if one exists) in the Snowflake Information Schema.
To determine whether a snapshot policy is associated with any snapshot sets, use the SHOW SNAPSHOT SETS command.
Note
The snapshot policy is an object that’s inside a specific schema and database. Therefore, the policy gets replicated, dropped or undropped, and so on, when those operations are performed on the schema and database that contain it. If you can’t drop the snapshot policy because it’s associated with any snapshot sets, then you also can’t drop the schema or database containing the policy.
Output¶
Column |
Description |
---|---|
|
Timestamp snapshot policy was created. |
|
Name of snapshot policy. |
|
Name of database that contains the snapshot policy. |
|
Name of schema that contains the snapshot policy. |
|
Name of the role with the OWNERSHIP privilege on the snapshot policy. |
|
Comment for snapshot policy. |
|
Schedule for snapshot creation. |
|
Number of days after snapshot creation when snapshot expires. |
|
Indicates whether the policy includes a retention lock.
For more information, see Retention lock. |
|
Name of the role with the OWNERSHIP privilege on the snapshot set. |
|
Type of role with the OWNERSHIP privilege on the snapshot policy. |
Examples¶
List all snapshot policies you have privileges for in the current account:
SHOW SNAPSHOT POLICIES IN ACCOUNT;