Library /
Rule
Rebuild on write
A scheduling rule that runs a Dataform release whenever BigQuery writes to the table the action builds.
Use it when A table is written outside Dataform and the action that owns it should rebuild right after.
- name: Rebuild a Dataform action after its own table is written
code_id: examples/dataform-on-write
description: Runs a Dataform release whenever BigQuery writes to the table the action builds.
priority: 1
status: active
applies_to:
node_type: DataformAction
node_ids:
- DataformAction_YOUR_PROJECT.YOUR_DATASET.YOUR_TABLE
when:
events:
- origin: self
types:
- BIGQUERY_INSERT
- BIGQUERY_UPDATE
- BIGQUERY_MERGE
- BIGQUERY_TRUNCATE
then:
target:
same_as_applies_to: true
scope: node
do:
kind: single
action:
type: dataform_run
parameters:
release_config: projects/YOUR_PROJECT/locations/YOUR_REGION/repositories/YOUR_REPOSITORY/releaseConfigs/YOUR_RELEASE_CONFIG
- Line 12the action's own table, not its sources
- Line 13matched exactly: list every write type you care about
Taken from examples/rules/dataform-scheduling-example.json
The repository keeps this rule as JSON; here it is in YAML, key for key, since a rules file may be either. The two comments are ours, from the scheduling docs.
origin: self listens to writes on the node the rule applies to. Event types are matched exactly, so a rule that lists
BIGQUERY_MERGE does not fire on BIGQUERY_INSERT: the four types here cover the usual ways a table is written. Add an
if.quiet_period_seconds when the table is written many times in a row.
Feeds fromGoogle Cloud