CREATE PRIVACY POLICY
statementsupportedGovernance (policies, tags, data quality)Enterprise+Creates a new privacy policy or replaces an existing privacy policy.
Syntax
supportedpartialnot supportednot scored
CREATE [ OR REPLACE ] PRIVACY POLICY [ IF NOT EXISTS ] <name>
AS () RETURNS PRIVACY_BUDGET -> <body>
[ COMMENT = '<string_literal>' ]
Parameters
| Name | Required | Description |
|---|---|---|
name | required | String that specifies the identifier (that is, name) for the privacy policy; must be unique for the schema in which the privacy policy is created. In addition, the identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (for example, "My object"). Identifiers enclosed in double quotes are also case-sensitive. For more information, see Identifier requirements. |
BUDGET_NAME => expression | required | Resolves to the name of a privacy budget. Snowflake creates the privacy budget automatically when its name is specified in the body of the privacy policy. |
BUDGET_LIMIT => decimal | required | A decimal number > 0 that specifies the budget limit for this privacy policy. This controls the total amount of privacy loss allowed. Adjusting this value changes how many total differentially private aggregates can be calculated against tables protected by this privacy budget during the refresh period. When a query is run that would cause the cumulative privacy loss to exceed this number, the query will fail. As a rough estimate, a budget limit of 233 with MAX_BUDGET_PER_AGGREGATE=1 permits about 1000 aggregates per refresh period. Default: 233.0 |
MAX_BUDGET_PER_AGGREGATE => decimal | required | Specifies how much privacy budget is used for each aggregate function in a query. Adjusting this value changes the amount of noise added to each aggregate query, as well as the number of aggregates that can be calculated before the budget limit is reached. As an example, the query select count(*), avg(a) ... has two aggregates: count(*) and avg(a). Specify a decimal value > 0. Default: 0.5 |
BUDGET_WINDOW => string | required | How often the privacy budget is refreshed, that is, has its cumulative privacy loss reset to 0. Valid values: Daily: Refreshed every day at 12:00 AM UTC Weekly: Refreshed every Sunday at 12:00 AM UTC Monthly: Refreshed on the first day of the calendar month at 12:00 AM UTC Yearly: Refreshed on January 1 at 12:00 AM UTC Never: Privacy budget is never refreshed. Default: Weekly |
COMMENT = 'string_literal' | optional | Specifies a comment for the privacy policy. Default: No value |
Usage notes
- Regarding metadata: Attention Customers should ensure that no personal data (other than for a User object), sensitive data, export-controlled data, or other regulated data is entered as metadata when using the Snowflake service. For more information, see Metadata fields in Snowflake.
- The OR REPLACE and IF NOT EXISTS clauses are mutually exclusive. They can’t both be used in the same statement.
- CREATE OR REPLACE <object> statements are atomic. That is, when an object is replaced, the old object is deleted and the new object is created in a single transaction.
Access control requirements
A role used to execute this operation must have the following privileges at a minimum: Privilege | Object | Notes CREATE PRIVACY POLICY | Schema | Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema. For instructions on creating a custom role with a specified set of privileges, see Creating custom roles. For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.