ALTER DYNAMIC TABLE

Modifies the properties of a dynamic table.

See also:

CREATE DYNAMIC TABLE, DESCRIBE DYNAMIC TABLE, DROP DYNAMIC TABLE, SHOW DYNAMIC TABLES

语法

ALTER DYNAMIC TABLE [ IF EXISTS ] <name> { SUSPEND | RESUME }

ALTER DYNAMIC TABLE [ IF EXISTS ] <name> RENAME TO <new_name>

ALTER DYNAMIC TABLE [ IF EXISTS ] <name> SWAP WITH <target_dynamic_table_name>

ALTER DYNAMIC TABLE [ IF EXISTS ] <name> REFRESH [ COPY SESSION ]

ALTER DYNAMIC TABLE [ IF EXISTS ] <name> { clusteringAction }

ALTER DYNAMIC TABLE [ IF EXISTS ] <name> { tableColumnCommentAction }

ALTER DYNAMIC TABLE <name> { SET | UNSET } COMMENT = '<string_literal>'

ALTER DYNAMIC TABLE [ IF EXISTS ] <name> dataGovnPolicyTagAction

ALTER DYNAMIC TABLE [ IF EXISTS ] <name> searchOptimizationAction

ALTER DYNAMIC TABLE [ IF EXISTS ] <name> SET
  [ TARGET_LAG = { '<num> { seconds | minutes | hours | days }'  | DOWNSTREAM } ],
  [ SCHEDULER = DISABLE | ENABLE ],
  [ WAREHOUSE = <warehouse_name> ],
  [ INITIALIZATION_WAREHOUSE = <warehouse_name> ],
  [ DATA_RETENTION_TIME_IN_DAYS = <integer> ],
  [ MAX_DATA_EXTENSION_TIME_IN_DAYS = <integer> ]
  [ DEFAULT_DDL_COLLATION = '<collation_specification>' ],
  [ LOG_LEVEL = '<log_level>' ],
  [ CONTACT ( <purpose> = <contact_name> [ , <purpose> = <contact_name> ... ] ) ],
  [ IMMUTABLE WHERE ( <expr> ) ],
  [ EXECUTE AS USER <user_name>
    [ USE SECONDARY ROLES { ALL | NONE | <role> [ , ... ] } ]
  ]
  [ ROW_TIMESTAMP = { TRUE | FALSE } ]


ALTER DYNAMIC TABLE [ IF EXISTS ] <name> UNSET
  [ INITIALIZATION_WAREHOUSE ],
  [ DATA_RETENTION_TIME_IN_DAYS ],
  [ MAX_DATA_EXTENSION_TIME_IN_DAYS ],
  [ DEFAULT_DDL_COLLATION ],
  [ LOG_LEVEL ],
  [ CONTACT <purpose> ],
  [ IMMUTABLE WHERE ],
  [ EXECUTE AS USER ],
  [ ROW_TIMESTAMP ],
  [ DCM PROJECT ]

其中:

clusteringAction ::=
  {
    CLUSTER BY ( <expr> [ , <expr> , ... ] )
    | { SUSPEND | RESUME } RECLUSTER
    | DROP CLUSTERING KEY
  }

For more information, see Clustering Keys & Clustered Tables.

tableCommentAction ::=
  {
    ALTER | MODIFY [ ( ]
                           [ COLUMN ] <col1_name> COMMENT '<string>'
                         , [ COLUMN ] <col1_name> UNSET COMMENT
                       [ , ... ]
                   [ ) ]
  }
dataGovnPolicyTagAction ::=
  {
      ADD ROW ACCESS POLICY <policy_name> ON ( <col_name> [ , ... ] )
    | DROP ROW ACCESS POLICY <policy_name>
    | DROP ROW ACCESS POLICY <policy_name> ,
        ADD ROW ACCESS POLICY <policy_name> ON ( <col_name> [ , ... ] )
    | DROP ALL ROW ACCESS POLICIES
  }
  |
  {
    SET AGGREGATION POLICY <policy_name>
      [ ENTITY KEY ( <col_name> [, ... ] ) ]
      [ FORCE ]
  | UNSET AGGREGATION POLICY
  }
  |
  {
    { ALTER | MODIFY } [ COLUMN ] <col1_name>
        SET MASKING POLICY <policy_name>
          [ USING ( <col1_name> , <cond_col_1> , ... ) ] [ FORCE ]
      | UNSET MASKING POLICY
  }
  |
  { ALTER | MODIFY } [ COLUMN ] <col1_name> SET TAG
      <tag_name> = '<tag_value>' [ , <tag_name> = '<tag_value>' ... ]
      , [ COLUMN ] <col2_name> SET TAG
          <tag_name> = '<tag_value>' [ , <tag_name> = '<tag_value>' ... ]
  |
  {
    { ALTER | MODIFY } [ COLUMN ] <col1_name>
        SET PROJECTION POLICY <policy_name>
          [ FORCE ]
      | UNSET PROJECTION POLICY
}
|
  { ALTER | MODIFY } [ COLUMN ] <col1_name> UNSET TAG <tag_name> [ , <tag_name> ... ]
                  , [ COLUMN ] <col2_name> UNSET TAG <tag_name> [ , <tag_name> ... ]
  }
  |
  {
      SET TAG <tag_name> = '<tag_value>' [ , <tag_name> = '<tag_value>' ... ]
    | UNSET TAG <tag_name> [ , <tag_name> ... ]
  }
searchOptimizationAction ::=
  {
    ADD SEARCH OPTIMIZATION [
      ON <search_method_with_target> [ , <search_method_with_target> ... ]
        [ EQUALITY ]
      ]

    | DROP SEARCH OPTIMIZATION [
      ON { <search_method_with_target> | <column_name> | <expression_id> }
        [ EQUALITY ]
        [ , ... ]
      ]

    | SUSPEND SEARCH OPTIMIZATION [
       ON { <search_method_with_target> | <column_name> | <expression_id> }
          [ , ... ]
     ]

    | RESUME SEARCH OPTIMIZATION [
       ON { <search_method_with_target> | <column_name> | <expression_id> }
          [ , ... ]
     ]
  }

For details, see Search optimization actions (`searchOptimizationAction`).

参数

name

要更改的动态表的标识符。

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.

SUSPEND | RESUME

指定要对动态表执行的操作:

  • SUSPEND suspends refreshes on the dynamic table. If the dynamic table is used by other dynamic tables, they are also suspended.
  • RESUME resumes refreshes on the dynamic table. Resume operations cascade downstream to all downstream dynamic tables not manually suspended.

When SCHEDULER = DISABLE, the command isolates the dynamic table from pipeline scheduling. TARGET_LAG-based refresh is suspended, and a manual refresh on this dynamic table doesn’t cascade to upstream dynamic tables.

RENAME TO new_name

使用当前未被架构中的任何其他动态表使用的新标识符重命名指定的动态表。

重命名动态表需要动态表架构的 CREATE DYNAMIC TABLE 权限。

You can also move the dynamic table to a different database and/or schema while optionally renaming the dynamic table. 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.new_name or schema_name.new_name, respectively.

以下限制条件适用:

  • 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.
  • You can’t move an object to a managed access schema unless the object owner (that is, the role that has the OWNERSHIP privilege on the object) also owns the target schema.
  • When an object (table, column, etc.) is renamed, other objects that reference it must be updated with the new name.
SWAP WITH target_dynamic_table_name

在单个事务中交换两个动态表。用于执行此操作的角色必须对两个动态表都具有 OWNERSHIP 权限。

以下限制条件适用:

  • 只能将一个动态表与另一个动态表交换。
REFRESH [ COPY SESSION ]

指定应手动刷新动态表。

Both user-suspended and auto-suspended dynamic tables can be manually refreshed. Manually refreshed dynamic tables return MANUAL as the output for refresh_trigger in the DYNAMIC_TABLE_REFRESH_HISTORY function.

When SCHEDULER = DISABLE, refreshing a dynamic table only refreshes that table and doesn’t cascade to any other dynamic tables.

When SCHEDULER = ENABLE, refreshing a dynamic table also refreshes all upstream dynamic tables, but the cascade stops at any upstream dynamic table that has SCHEDULER = DISABLE.

For information on dynamic table refresh status, see DYNAMIC_TABLE_REFRESH_HISTORY.

COPY SESSION

使用当前用户和仓库在当前会话的副本中运行刷新操作。

This only applies to a single manual refresh; it does not permanently update the credentials for the dynamic table. Use the GRANT OWNERSHIP command to transfer the ownership for scheduled refreshes. For more information, see Transfer ownership.

主要角色是拥有动态表的角色,次要角色将匹配用户的 DEFAULT_SECONDARY_ROLES 属性。

SET ...

指定要为表设置的一个或多个属性/参数(用空格、逗号或新行分隔):

TARGET_LAG = { num { seconds | minutes | hours | days } | DOWNSTREAM }

为动态表指定目标滞后时间:

'num seconds | minutes | hours | days'

指定动态表内容滞后于基表更新的最长时间。

例如:

  • If the data in the dynamic table should lag by no more than 5 minutes, specify 5 minutes.
  • If the data in the dynamic table should lag by no more than 5 hours, specify 5 hours.

最小值为 1 分钟。如果动态表 A 依赖于另一个动态表 B,则 A 的最小滞后时间必须大于或等于 B 的滞后时间。

DOWNSTREAM

指定在动态表的任何下游动态表被刷新时,应该刷新动态表。

SCHEDULER = { DISABLE | ENABLE }

Specifies whether the dynamic table is to be refreshed automatically by Snowflake’s dynamic table scheduler.

DISABLE

Excludes the dynamic table from automatic background refresh. The table isn’t refreshed on a schedule, either directly or through downstream dependencies.

  • Manual control: Refreshing must be triggered manually by using ALTER DYNAMIC TABLE ... REFRESH.
  • Isolation: A manual refresh of a disabled table doesn’t automatically refresh its upstream dependencies. This creates a “isolation boundary,” allowing external orchestrators, like dbt, to manage specific table refreshes in isolation without triggering the entire pipeline.
  • TARGET_LAG can’t be defined when SCHEDULER = DISABLE.
ENABLE

Enables the automated background scheduler for the dynamic table. The scheduler ensures that the table is refreshed alongside its dependencies to maintain snapshot consistency. In this mode, Snowflake automatically calculates the optimal refresh frequency based on the defined TARGET_LAG.

WAREHOUSE = warehouse_name

指定提供计算资源以刷新动态表的仓库的名称。

You must use a role that has the USAGE privilege on this warehouse. For more information, see Privileges to create a dynamic table.

For guidance on choosing a warehouse for optimal refresh performance, see Adjust your warehouse configuration.

INITIALIZATION_WAREHOUSE = warehouse_name

Specifies a warehouse to use for all dynamic table initializations and reinitializations.

When this parameter is set, the specified warehouse is used for all initializations and reinitializations; otherwise, the dynamic table uses the warehouse that is specified by the required WAREHOUSE parameter for all refreshes.

You must use a role that has the USAGE privilege on this warehouse. For more information, see Privileges to create a dynamic table.

DATA_RETENTION_TIME_IN_DAYS = integer

Object-level parameter that modifies the retention period for the dynamic table for Time Travel. For more details, see Understanding & using Time Travel and Working with Temporary and Transient Tables.

For a detailed description of this parameter and more information about object parameters, see Parameters.

值:

  • Standard Edition: 0 or 1
  • Enterprise Edition:
    • 0 to 90 for permanent dynamic tables
    • 0 or 1 for transient dynamic tables

Note

A value of 0 effectively disables Time Travel for the dynamic table.

MAX_DATA_EXTENSION_TIME_IN_DAYS = integer

对象参数,用于指定 Snowflake 可延长数据保留期的最长天数,以防止动态表上的数据流过时。

For a detailed description of this parameter, see MAX_DATA_EXTENSION_TIME_IN_DAYS.

DEFAULT_DDL_COLLATION = 'collation_specification'

Specifies a default collation specification for any new columns added to the dynamic table.

Setting this parameter does not change the collation specification for any existing columns.

For more information, see DEFAULT_DDL_COLLATION.

LOG_LEVEL = 'log_level'

Specifies the severity level of events for this dynamic table that are ingested and made available in the active event table. Events at the specified level (and at more severe levels) are ingested.

For more information about levels, see LOG_LEVEL. For information about setting the log level, see Setting levels for logging, metrics, and tracing.

CONTACT purpose = contact [ , purpose = contact ... ]

Associate the existing object with one or more contacts. For a list of valid purposes, see Associate a contact with an object.

You cannot set the CONTACT property with other properties in the same statement.

IMMUTABLE WHERE

Specifies a condition that defines the immutable portion of the dynamic table. For more information, see Understanding immutability constraints. If the dynamic table has primary key or unique constraints with the RELY property, the columns in the predicate must be a subset of the columns in those RELY constraints. For details, see Interaction with primary key and unique constraints (RELY).

EXECUTE AS USER user_name

Refreshes the dynamic table as the specified user, rather than as the SYSTEM user.

To specify EXECUTE AS USER, you must use a role that has been granted the IMPERSONATE privilege on the user_name user. To grant this privilege, run the GRANT <privileges> … TO ROLE command.

USE SECONDARY ROLES { ALL | NONE | role [ , ... ] }

Specifies the secondary roles to use on the dynamic table. Can be used to override the default secondary roles that are otherwise used in execution.

Can only be used with the EXECUTE AS USER option.

For more information, see Refresh dynamic tables with specific user privileges and secondary roles.

ROW_TIMESTAMP = { TRUE | FALSE }

Adds or removes row timestamps on the table.

  • TRUE adds row timestamps on the table.
  • FALSE removes row timestamps on the table. This parameter setting permanently deletes all stored METADATA$ROW_LAST_COMMIT_TIME values. Reenabling it will not restore these values and Time Travel queries will return nothing.
UNSET ...

指定要为动态表取消设置的一个或多个属性/参数,这会将它们重置回默认值:

  • INITIALIZATION_WAREHOUSE
  • DATA_RETENTION_TIME_IN_DAYS
  • MAX_DATA_EXTENSION_TIME_IN_DAYS
  • DEFAULT_DDL_COLLATION
  • LOG_LEVEL
  • CONTACT purposes
  • IMMUTABLE WHERE
  • EXECUTE AS USER
  • ROW_TIMESTAMP
  • DCM PROJECT

UNSET DCM PROJECT

Detaches the dynamic table from the DCM project that currently manages it. The command removes the association between the dynamic table and the DCM project without dropping the dynamic table. See Detach objects from a DCM project for more information.

Clustering actions (clusteringAction)

CLUSTER BY ( expr [ , expr , ... ] )

Specifies (or modifies) one or more table columns or column expressions as the clustering key for the dynamic table. These are the columns/expressions for which clustering is maintained by Automatic Clustering. Before you specify a clustering key for a dynamic table, you should understand micro-partitions. For more information, see Understanding Snowflake Table Structures.

将群集密钥与动态表一起使用时请注意以下几点:

  • 列定义是必需的,必须在语句中明确指定。
  • Clustering keys are not intended or recommended for all tables; they typically benefit very large (for example, multi-terabyte) tables.
SUSPEND | RESUME RECLUSTER

Enables or disables Automatic Clustering for the dynamic table.

DROP CLUSTERING KEY

删除动态表的群集密钥。

For more information about clustering keys and reclustering, see Understanding Snowflake Table Structures.

Table comment actions (tableCommentAction)

ALTER | MODIFY [ ( ]
[ COLUMN ] <col1_name> COMMENT '<string>'
, [ COLUMN ] <col1_name> UNSET COMMENT
[ , ... ]
[ ) ]

更改动态表中列的注释或覆盖现有注释。

SET | UNSET COMMENT = '<string_literal>'

添加注释或覆盖动态表的现有注释。

Data Governance policy and tag actions (dataGovnPolicyTagAction)

TAG tag_name = 'tag_value' [ , tag_name = 'tag_value' , ... ]

Specifies the tag name and the tag string value.

The tag value is always a string, and the maximum number of characters for the tag value is 256.

For information about specifying tags in a statement, see Tag quotas.

policy_name

策略的标识符;对于架构必须是唯一的。

ADD ROW ACCESS POLICY policy_name ON (col_name [ , ... ])

向动态表中添加行访问策略。

必须至少指定一个列名称。可以使用逗号分隔每个列名称来指定其他列。

DROP ROW ACCESS POLICY policy_name

从动态表中删除行访问策略。

DROP ROW ACCESS POLICY policy_name, ADD ROW ACCESS POLICY policy_name ON ( col_name [ , ... ] )

在单个 SQL 语句中,删除在动态表上设置的行访问策略,并向同一个动态表添加行访问策略。

DROP ALL ROW ACCESS POLICIES

Drops all row access policy associations from the dynamic table.

You must also use this clause to access a dynamic table that you restore from a backup, if a row access policy applied to the table when the backup was created and the policy was later dropped. After the dynamic table is restored, you can’t query it until you run an ALTER TABLE command with the DROP ALL ROW ACCESS POLICIES clause.

{ ALTER | MODIFY } [ COLUMN ] ...
USING ( col_name , cond_col_1 ... )

指定要传递到条件掩码策略的实参。

The first column in the list specifies the data to be masked or tokenized based on policy conditions and must match the column to which the masking policy is applied.

附加列指定了当从第一列中进行选择时,要在查询结果的每一行中评估哪些数据以进行掩码或令牌化处理。

If the USING clause is omitted, Snowflake treats the conditional masking policy as a normal masking policy.

SET AGGREGATION POLICY {policy_name}
[ ENTITY KEY ({col_name} [ , ... ]) ] [ FORCE ]

Assigns an aggregation policy to the dynamic table.

Use the optional ENTITY KEY parameter to define which columns uniquely identity an entity within the dynamic table. For more information, see Implementing entity-level privacy with aggregation policies.

使用可选 FORCE 参数以原子方式将现有聚合策略替换为新的聚合策略。

UNSET AGGREGATION POLICY

从动态表中分离聚合策略。

FORCE

在单个语句中将当前为列设置的掩码或投影策略替换为其他策略。

Note that using the FORCE keyword with a masking policy requires the data type of the policy in the ALTER DYNAMIC TABLE statement (i.e. STRING) to match the data type of the masking policy currently set on the column (i.e. STRING).

如果当前没有为该列设置掩码策略,则指定此关键字无效。

For details, see: Replace a masking policy on a column or Replace a projection policy.

Search optimization actions (searchOptimizationAction)

ADD SEARCH OPTIMIZATION

Adds search optimization for the entire dynamic table or, if you specify the optional ON clause, for specific columns.

Search optimization can be expensive to maintain, especially if the data in the table changes frequently. For more information, see .

ON search_method_with_target [, search_method_with_target ... ]

指定要为特定列或 VARIANT 字段(而不是整个动态表)配置搜索优化。

For search_method_with_target, use an expression with the following syntax:

<search_method>(<target> [, ...])

其中:

  • search_method specifies one of the following methods that optimizes queries for a particular type of predicate:

  • target specifies the column, VARIANT field, or an asterisk (*).

    Depending on the value of search_method, you can specify a column or VARIANT field of one of the following types:

    • GEO: Columns of the GEOGRAPHY data type.

    • SUBSTRING: Columns of string or VARIANT data types, including paths to fields in VARIANTs. Specify paths to fields as described under EQUALITY; searches on nested fields are improved in the same way.

    • EQUALITY: Columns of numeric, string, binary, and VARIANT data types, including paths to fields in VARIANT columns.

      To specify a VARIANT field, use dot or bracket notation. For example:

      • my_column:my_field_name.my_nested_field_name
      • my_column['my_field_name']['my_nested_field_name']

您也可以使用冒号分隔的字段路径。例如:

  • my_column:my_field_name:my_nested_field_name

指定 VARIANT 字段时,该配置将应用于该字段下的所有嵌套字段。

For example, if you specify ON EQUALITY(src:a.b):

  • This configuration can improve queries on src:a.b and on any nested fields (for example, src:a.b.c, src:a.b.c.d, etc.).
  • This configuration only affects queries that use the src:a.b prefix (for example, src:a, src:z, etc.).

To specify all applicable columns in the table as targets, use an asterisk (*).

Note that you can’t specify both an asterisk and specific column names for a given search method. However, you can specify an asterisk in different search methods.

例如,您可以指定以下表达式:

ON SUBSTRING(*)
ON EQUALITY(*), SUBSTRING(*), GEO(*)

不能指定以下表达式:

ON EQUALITY(*, c1)
ON EQUALITY(c1, *)
ON EQUALITY(v1:path, *)
ON EQUALITY(c1), EQUALITY(*)

若要在目标上指定多个搜索方法,请使用逗号分隔每个后续方法和目标:

ALTER DYNAMIC TABLE my_dynamic_table ADD SEARCH OPTIMIZATION ON EQUALITY(c1), EQUALITY(c2, c3);

如果您在同一事件表上多次运行 ALTER DYNAMIC TABLE …ADD SEARCH OPTIMIZATION ON … 命令,则每个后续命令都会添加到表的现有配置中。例如,假设您运行以下命令:

ALTER DYNAMIC TABLE my_dynamic_table ADD SEARCH OPTIMIZATION ON EQUALITY(c1, c2);
ALTER DYNAMIC TABLE my_dynamic_table ADD SEARCH OPTIMIZATION ON EQUALITY(c3, c4);

This adds equality predicates for the columns c1, c2, c3, and c4 to the configuration for the table. This is equivalent to running the command:

ALTER DYNAMIC TABLE my_dynamic_table ADD SEARCH OPTIMIZATION ON EQUALITY(c1, c2, c3, c4);

For examples, see Enabling search optimization for specific columns.

DROP SEARCH OPTIMIZATION

Removes search optimization for the entire dynamic table or, if you specify the optional ON clause, from specific columns.

以下限制条件适用:

  • If a dynamic table has the search optimization property, then dropping the dynamic table and undropping it preserves the search optimization property.
  • Removing the search optimization property from a dynamic table and then adding it back incurs the same cost as adding it the first time.
ON search_method_with_target | column_name | expression_id [, ... ]

指定要为特定列或 VARIANT 字段删除搜索优化配置(而不是删除整个动态表的搜索优化)。

若要标识要删除的列配置,请指定以下配置之一:

  • For search_method_with_target, specify a method for optimizing queries for one or more specific targets, which can be columns or VARIANT fields. Use the syntax described earlier.
  • For column_name, specify the name of the column configured for search optimization. Specifying the column name drops all expressions for that column, including expressions that use VARIANT fields in the column.
  • For expression_id, specify the ID for an expression listed in the output of the DESCRIBE SEARCH OPTIMIZATION command.

可以通过在各项之间使用逗号,指定具有目标、列名和表达式 IDs 的搜索方法的任意组合。

For examples, see Dropping search optimization for specific columns.

访问控制要求

A role used to execute this operation must have the following privileges at a minimum:

权限对象备注
OWNERSHIP 或 OPERATE您要修改的动态表。Some actions are only supported with the OWNERSHIP privilege. For more information, see Privileges to alter a dynamic table.

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.

使用说明

  • To alter a dynamic table, you must be using a role that has OPERATE privilege on that dynamic table. For general information, see Privileges to view a dynamic table’s metadata.

  • Making changes to masking policies on a base table causes a reinitialization.

  • If you want to update an existing dynamic table and need to see its current definition, call the GET_DDL function.

  • You can use data metric functions with dynamic tables by executing an ALTER TABLE command. For more information, see Use SQL to set up data metric functions.

  • You cannot use IDENTIFIER() to specify the name of the dynamic table to alter. For example, the following statement isn’t supported:

    ALTER DYNAMIC TABLE IDENTIFIER(my_dynamic_table) SUSPEND;
  • After a reinitialization or full refresh, search indexes on dynamic tables are rebuilt. This process involves dropping the existing indexes and rebuilding them from scratch, which might incur higher costs. For more information, see Search optimization cost estimation and management.

  • 关于元数据:

    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.

示例

Change the target lag time of a dynamic table named my_dynamic_table to 1 hour:

ALTER DYNAMIC TABLE my_dynamic_table SET
  TARGET_LAG = '1 hour';

Specify downstream target lag for my_dynamic_table:

ALTER DYNAMIC TABLE my_dynamic_table SET TARGET_LAG = DOWNSTREAM;

暂停动态表:

ALTER DYNAMIC TABLE my_dynamic_table SUSPEND;

恢复动态表:

ALTER DYNAMIC TABLE my_dynamic_table RESUME;

Rename my_dynamic_table:

ALTER DYNAMIC TABLE my_dynamic_table RENAME TO my_updated_dynamic_table;

Swap my_dynamic_table with my_new_dynamic_table:

ALTER DYNAMIC TABLE my_dynamic_table SWAP WITH my_new_dynamic_table;

更改动态表的群集密钥:

ALTER DYNAMIC TABLE my_dynamic_table CLUSTER BY (date);

从动态表中移除群集:

ALTER DYNAMIC TABLE my_dynamic_table DROP CLUSTERING KEY;

Perform a manual refresh of my_dynamic_table using the user, secondary roles, and warehouse settings from the current session. This ensures that the refresh operation runs with the exact context of the user session.

ALTER DYNAMIC TABLE my_dynamic_table REFRESH COPY SESSION

To modify or remove an existing constraint, you can replace a predicate:

ALTER DYNAMIC TABLE my_dynamic_table SET IMMUTABLE WHERE ( <new_expr> );

Alternatively, remove an immutability predicate:

ALTER DYNAMIC TABLE my_dynamic_table UNSET IMMUTABLE WHERE;