REFRESH (MATERIALIZED VIEW and STREAMING TABLE)

Applies to: check marked yes Databricks SQL

Preview

This feature is in Public Preview. To sign up for access, fill out this form.

Refresh the data for a streaming table or a materialized view. The data is refreshed asynchronously. You can track the status of the refresh by executing DESCRIBE EXTENDED.

Syntax

REFRESH { MATERIALIZED VIEW | [ STREAMING ] TABLE } table_name [ FULL ]

Parameters

  • table_name

    Identifies the materialized view or streaming table to refresh. The name must not include a temporal specification. If the object cannot be found Databricks raises a TABLE_OR_VIEW_NOT_FOUND error.

  • FULL

    Whether to perform a full refresh, which truncates the table and process all data available in the source with the latest definition of the streaming table. Materialized views do not support full refreshes.

    It is not recommended to call full refreshes on sources that don’t keep the entire history of the data or have short retention periods, such as Kafka, as the full refresh truncates the existing data. You may not be able to recover old data if the data is no longer available in the source.

Examples

-- Refreshes the materialized view to reflect the latest available data
> REFRESH MATERIALIZED VIEW catalog.schema.view_name;

-- Refreshes the streaming table to process the latest available data
-- The current catalog and schema will be used to qualify the table
> REFRESH STREAMING TABLE st_name;

-- Truncates the table and processes all data from scratch for the streaming table
> REFRESH TABLE cat.db.st_name FULL;