ALTER DATA MOVEMENT POLICY¶
Modifies the properties of an existing data movement policy. You can replace, add to, or remove from the rule lists, set or unset the comment, and rename the policy.
Any changes to the policy rules go into effect when the next data movement operation that uses the policy runs.
Syntax¶
In the SET, ADD, and REMOVE forms, specify at least one property. You can specify more than one property in a single
statement.
Parameters¶
nameSpecifies the identifier for the data movement policy to alter.
If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.
For more information, see Identifier requirements.
RENAME TO new_nameSpecifies the new identifier for the data movement policy; must be unique for the schema. The new identifier can’t be used if the identifier is already in place for a different data movement policy.
For more details about identifiers, see Identifier requirements.
You can move the object to a different database and/or schema while optionally renaming the object. To do so, specify a qualified
new_namevalue that includes the new database and/or schema name in the formdb_name.schema_name.object_nameorschema_name.object_name, respectively.Note
- The destination database and/or schema must already exist. In addition, an object with the same name cannot already exist in the new location; otherwise, the statement returns an error.
- Moving an object to a managed access schema is prohibited unless the object owner (that is, the role that has the OWNERSHIP privilege on the object) also owns the target schema.
When an object is renamed, other objects that reference it must be updated with the new name.
SET ...Replaces the entire contents of the specified rule lists, the comment, or any combination of these for the data movement policy:
ENFORCE_RULES = ( rule_name [ , rule_name , ... ] )Replaces the current
ENFORCE_RULESlist with the specified data movement rules. These rules block a data movement operation when the operation matches a rule.ALERT_RULES = ( rule_name [ , rule_name , ... ] )Replaces the current
ALERT_RULESlist with the specified data movement rules. These rules allow a data movement operation and generate an alert when the operation matches a rule.COMMENT = 'string_literal'Adds a comment or overwrites the existing comment for the data movement policy.
ADD ...Adds the specified data movement rules to the
ENFORCE_RULESlist, theALERT_RULESlist, or both lists without replacing the rules already in the lists:-
ENFORCE_RULES = ( rule_name [ , rule_name , ... ] ) -
ALERT_RULES = ( rule_name [ , rule_name , ... ] )
-
REMOVE ...Removes the specified data movement rules from the
ENFORCE_RULESlist, theALERT_RULESlist, or both lists without affecting the other rules in the lists:-
ENFORCE_RULES = ( rule_name [ , rule_name , ... ] ) -
ALERT_RULES = ( rule_name [ , rule_name , ... ] )
A REMOVE operation succeeds only if each specified rule is currently in the specified list.
-
UNSET ...Resets the specified properties to their defaults. You can unset more than one property in a single statement:
ENFORCE_RULES- Removes all rules from theENFORCE_RULESlist.ALERT_RULES- Removes all rules from theALERT_RULESlist.COMMENT- Removes the comment.
To unset multiple properties or parameters with a single ALTER statement, separate each property or parameter with a comma.
When unsetting a property or parameter, specify only the property or parameter name (unless the syntax above indicates that you should specify the value). Specifying the value returns an error.
Access control requirements¶
A role used to execute this operation must have the following privileges at a minimum:
| Privilege | Object | Notes |
|---|---|---|
| OWNERSHIP | Data movement policy | OWNERSHIP is a special privilege on an object that is automatically granted to the role that created the object, but can also be transferred using the GRANT OWNERSHIP command to a different role by the owning role (or any role with the MANAGE GRANTS privilege). |
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.
Usage notes¶
-
SET replaces the entire contents of a rule list. ADD and REMOVE modify a list incrementally, leaving the other rules in the list unchanged.
-
A data movement rule can’t appear in both
ENFORCE_RULESandALERT_RULESat the same time, and each list can include at most one rule per data movement type. -
A data movement policy that’s attached to a tag or the account can’t be left with both the
ENFORCE_RULESandALERT_RULESlists empty by a SET, REMOVE, or UNSET operation. -
Rule names are resolved the same way as in CREATE DATA MOVEMENT POLICY: a name without a database or schema is resolved in the current database and schema.
-
If you want to see the current definition of the policy, run the DESCRIBE DATA MOVEMENT POLICY command or GET_DDL function.
-
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.
Examples¶
Replace the entire ENFORCE_RULES list:
Replace the ENFORCE_RULES list and the comment in one statement:
Add a rule to the ENFORCE_RULES list without replacing the existing rules:
Remove a rule from the ALERT_RULES list:
Remove all rules from the ALERT_RULES list and remove the comment:
Rename a data movement policy: