Skip to content

feat: support TRIGGER ON UPDATE and SCHEDULE EVERY for MV and ST#1434

Open
sd-db wants to merge 1 commit into1.12.latestfrom
sd-db/feature/mv-st-trigger-schedule-syntax
Open

feat: support TRIGGER ON UPDATE and SCHEDULE EVERY for MV and ST#1434
sd-db wants to merge 1 commit into1.12.latestfrom
sd-db/feature/mv-st-trigger-schedule-syntax

Conversation

@sd-db
Copy link
Copy Markdown
Collaborator

@sd-db sd-db commented Apr 30, 2026

Summary

Adds the full Databricks refresh-schedule grammar on materialized views and streaming tables: `SCHEDULE CRON`, `SCHEDULE EVERY`, and `TRIGGER ON UPDATE [AT MOST EVERY INTERVAL ...]`.

Closes #1293.

User-facing config:

config:
  schedule:
    cron: '0 0 * * * ? *'
    time_zone_value: 'America/Los_Angeles'
    # OR
    every: '2 HOURS'
    # OR
    on_update: true
    at_most_every: '15 MINUTES'

Test plan

  • Unit tests for parser, validator, diff, and refresh-schedule macros (873 unit tests passing).
  • Functional round-trip tests per mode for both MV and ST against live UC SQL endpoint.
  • Functional lifecycle tests walking each relation through MANUAL → CRON → ON_UPDATE → EVERY → (non-refresh component change) → MANUAL.
  • `pre-commit run --all-files` clean (ruff, ruff-format, mypy).

Adds the full Databricks refresh-schedule grammar on materialized
views and streaming tables: SCHEDULE CRON, SCHEDULE EVERY, and
TRIGGER ON UPDATE [AT MOST EVERY INTERVAL ...].

- RefreshConfig is a discriminated config with parse-time validation
  on the new modes.
- Idempotent runs no longer emit spurious ALTERs across user/server
  unit differences.
- Auto-REFRESH is suppressed for every/on_update modes.

Coverage:
- Unit tests for parser, validator, diff, and refresh-schedule macros.
- Functional round-trip tests per mode for both MV and ST.
- Functional lifecycle tests walking each relation through every mode
  transition plus a non-refresh-component change.
@github-actions
Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  dbt/adapters/databricks/relation_configs
  refresh.py 46, 55, 66, 134, 157, 180, 211, 220
  streaming_table.py
Project Total  

This report was generated by python-coverage-comment-action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant