snowflake.snowpark.DataFrame.create_or_replace_dynamic_table

DataFrame.create_or_replace_dynamic_table(name: Union[str, Iterable[str]], *, warehouse: str, lag: str, comment: Optional[str] = None, mode: str = 'overwrite', refresh_mode: Optional[str] = None, initialize: Optional[str] = None, clustering_keys: Optional[Iterable[Union[Column, str]]] = None, is_transient: bool = False, data_retention_time: Optional[int] = None, max_data_extension_time: Optional[int] = None, statement_params: Optional[Dict[str, str]] = None) List[Row][source]

Creates a dynamic table that captures the computation expressed by this DataFrame.

For name, you can include the database and schema name (i.e. specify a fully-qualified name). If no database name or schema name are specified, the dynamic table will be created in the current database or schema.

name must be a valid Snowflake identifier.

Parameters:
  • name – The name of the dynamic table to create or replace. Can be a list of strings that specifies the database name, schema name, and view name.

  • warehouse – The name of the warehouse used to refresh the dynamic table.

  • lag – specifies the target data freshness

  • comment – Adds a comment for the created table. See COMMENT.

  • mode – Specifies the behavior of create dynamic table. Allowed values are: - “overwrite” (default): Overwrite the table by dropping the old table. - “errorifexists”: Throw and exception if the table already exists. - “ignore”: Ignore the operation if table already exists.

  • refresh_mode – Specifies the refresh mode of the dynamic table. The value can be “AUTO”, “FULL”, or “INCREMENTAL”.

  • initialize – Specifies the behavior of initial refresh. The value can be “ON_CREATE” or “ON_SCHEDULE”.

  • clustering_keys – Specifies one or more columns or column expressions in the table as the clustering key. See Clustering Keys & Clustered Tables for more details.

  • is_transient – A boolean value that specifies whether the dynamic table is transient.

  • data_retention_time – Specifies the retention period for the dynamic table in days so that Time Travel actions can be performed on historical data in the dynamic table.

  • max_data_extension_time – Specifies the maximum number of days for which Snowflake can extend the data retention period of the dynamic table to prevent streams on the dynamic table from becoming stale.

  • statement_params – Dictionary of statement level parameters to be set while executing this action.

Note

See understanding dynamic table refresh. for more details on refresh mode.