ALTER DATA MOVEMENT RULE

statementsupportedGovernance (policies, tags, data quality)Enterprise+

docs.snowflake.com ↗

Object: DATA MOVEMENT RULE

Replaces the MAX_ROWS expression of an existing data movement rule, sets or unsets its comment, or renames the rule. Any changes to the rule take effect the next time a data movement policy that uses the rule is evaluated.

Syntax

supportedpartialnot supportednot scored

ALTER DATA MOVEMENT RULE [ IF EXISTS ] <name>
  SET MAX_ROWS AS () RETURNS INTEGER
  -> ( <expression> )

ALTER DATA MOVEMENT RULE [ IF EXISTS ] <name> SET COMMENT = '<string_literal>'

ALTER DATA MOVEMENT RULE [ IF EXISTS ] <name> UNSET COMMENT

ALTER DATA MOVEMENT RULE [ IF EXISTS ] <name> RENAME TO <new_name>

Parameters

NameRequiredDescription
nameSpecifies the identifier for the data movement rule 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 rule; must be unique for your schema. The new identifier can’t be used if the identifier is already in place for a different data movement rule. For more details, 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_name value that includes the new database and/or schema name in the form db_name.schema_name.object_name or schema_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.
SET ...Specifies the property to set for the data movement rule. You can set one property in each statement:
MAX_ROWS AS () RETURNS INTEGER -> ( expression )SQL expression body that returns an INTEGER, which sets the maximum number of rows that the movement type can move. The return value determines the behavior: NULL - No limit on the number of rows. 0 - Block the movement. A positive integer - The maximum number of rows that the movement type can move. The expression can contain CASE and other logic statements. It can call SYS_CONTEXT to read session and movement context and adjust the returned limit accordingly.
COMMENT = 'string_literal'Adds a comment or overwrites the existing comment for the data movement rule. Default: No value
UNSET ...Specifies the property to unset for the data movement rule, which resets it to its default: 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.

Usage notes

Access control requirements

A role used to execute this operation must have the following privileges at a minimum: Privilege | Object | Notes OWNERSHIP | Data movement rule | 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.

See also

Referenced by