Skip to content

Materialization Strategies

Materialization strategies determine how SQL task results are stored and managed in the target database.

Replaces the entire table with new data on each run.

materialization:
type: "table"
strategy: "create+replace"
partition_by: "dt"
cluster_by: ["user_id", "event_type"]

Deletes existing data for a specific key and inserts new data.

materialization:
type: "table"
strategy: "delete+insert"
incremental_key: "dt"

Adds new data to the existing table without removing old data.

materialization:
type: "table"
strategy: "append"

Creates a virtual table that queries underlying data.

materialization:
type: "view"
materialization:
type: "table"
strategy: "create+replace"
partition_by: "dt"
materialization:
type: "table"
strategy: "create+replace"
partition_by: "user_id"
materialization:
type: "table"
strategy: "create+replace"
cluster_by: ["user_id"]
materialization:
type: "table"
strategy: "create+replace"
cluster_by: ["user_id", "event_type", "created_at"]
name: "analytics.daily_metrics"
type: "bq.sql"
description: "Calculate daily metrics"
run: "daily_metrics.sql"
materialization:
type: "table"
strategy: "create+replace"
partition_by: "dt"
cluster_by: ["user_id", "event_type"]
name: "analytics.user_events"
type: "bq.sql"
description: "Process user events incrementally"
run: "user_events.sql"
materialization:
type: "table"
strategy: "delete+insert"
incremental_key: "dt"
partition_by: "dt"
name: "logs.event_logs"
type: "bq.sql"
description: "Append event logs"
run: "event_logs.sql"
materialization:
type: "table"
strategy: "append"
partition_by: "dt"
name: "analytics.user_summary"
type: "bq.sql"
description: "Create user summary view"
run: "user_summary.sql"
materialization:
type: "view"
  • type: Materialization type (table or view)
  • strategy: Materialization strategy (for tables)
  • partition_by: Partition column
  • cluster_by: Clustering columns
  • incremental_key: Key for incremental processing