Skip to content

Allow configuring cascade deletion in DABs#5846

Open
ronaldz-db wants to merge 2 commits into
databricks:mainfrom
ronaldz-db:pipelines-destroy-cascade
Open

Allow configuring cascade deletion in DABs#5846
ronaldz-db wants to merge 2 commits into
databricks:mainfrom
ronaldz-db:pipelines-destroy-cascade

Conversation

@ronaldz-db

@ronaldz-db ronaldz-db commented Jul 8, 2026

Copy link
Copy Markdown

Changes

Add a cascade field to the pipeline bundle resource that controls whether destroying a pipeline also cascades to its datasets. When unset, we maintain the existing default of true.

This change applies to the direct engine. We have a separate change on the Terraform side: databricks/terraform-provider-databricks#5860

Why

Previously, pipeline deletion would automatically cascade to its tables. After user feedback, we decided to make this configurable in the DeletePipeline API. This extends support to DABs as well, which was another common user ask.

Tests

Unit tests

Add a `cascade` field to the pipeline bundle resource that controls whether
destroying a pipeline also deletes its datasets (materialized views, streaming
tables, and views). When unset, the server default applies (cascade); set
`cascade: false` to retain the datasets on destroy.

The field is delete-time only: it is not part of the pipeline spec, so it is
never sent on create/update. The direct engine persists it in state (via a
PipelineState wrapper around CreatePipeline, mirroring the sql_warehouse
lifecycle pattern) and reads it at delete time, force-sending cascade so an
explicit false survives query-string omitempty (honored for query params as of
databricks-sdk-go v0.152.0). A cascade-only change is a state-only update with
no pipeline API call. cascade is classified input_only so it does not show
remote drift.

The terraform engine drops the field for now: the pinned provider has no such
attribute yet (pending terraform-provider-databricks#5860), so terraform-engine
support is a follow-up.

Co-authored-by: Isaac
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

29 files changed
Suggested: @denik
Also eligible: @pietern, @janniklasrose, @andrewnester, @shreyas-goenka, @lennartkats-db, @anton-107

/acceptance/pipelines/ - needs approval

14 files changed
Suggested: @lennartkats-db
Also eligible: @kanterov, @jefferycheng1

/bundle/ - needs approval

11 files changed
Suggested: @denik
Also eligible: @pietern, @janniklasrose, @andrewnester, @shreyas-goenka, @lennartkats-db, @anton-107

General files (require maintainer)

Files: NEXT_CHANGELOG.md
Based on git history:

  • @denik -- recent work in bundle/direct/dresources/, bundle/phases/, bundle/config/mutator/

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose) can approve all areas.
See OWNERS for ownership rules.

PipelineId: id,
Cascade: *state.Cascade,
Force: false,
ForceSendFields: []string{"Cascade"},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment about why this is used for maintainers?

pipelines:
my_pipeline:
name: test-pipeline-cascade
cascade: false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should review the name of this propetty and whether we should fold it into any more general 'lifecycle' concept.

Note that, overall, I think this approach is sound: we have a pipeline-level property that defines the deletion behavior. As opposed to a parameter for 'databricks bundle destroy'.

Let me add @denik here in case he has considerations and I'll bring it up in the DABs Core meeting tomorrow.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed this:

Suggested change
cascade: false
cascade_on_destroy: false

would be the right name.

We have a purge_on_destroy that works the same way for Lakebase.

>>> print_requests.py //api/2.0/pipelines

=== Destroy: delete reads the updated cascade=true from persisted state
>>> [CLI] pipelines destroy --auto-approve

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should actually also work without --auto-approve: we should not show a warning when we know the remote pipeline datasets won't be deleted.

Related, when we do show a warning, the warning might need to mention this property.

pipelines:
my_pipeline:
name: test-pipeline-cascade
cascade: false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make sure the default template also sets purge_on_destroy: false? With a very short comment to the side explaining it? Could be a separate PR.

Comment on lines +1 to +2
# --cascade only affects the direct engine's delete request; the terraform engine deletes
# pipelines through the provider and ignores it. Restrict to direct so the recorded request

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a check to make sure there' a hard error when the new property is used with the Terraform engine?

… message fix

- Rename the pipeline config field cascade -> cascade_on_destroy, matching the
  Lakebase purge_on_delete precedent (per review discussion).
- Add ValidateCascadeOnDestroy mutator: hard error when the field is used with
  the terraform engine, which does not support it yet.
- Fix the destroy approval message so a pipeline with cascade_on_destroy: false
  is not described as deleting its STs/MVs, and mention the property otherwise.
- Comment why ForceSendFields is needed in DoDelete.
- Regenerate schema, refschema, and affected acceptance outputs.

Co-authored-by: Isaac
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 5846
  • Commit SHA: 7df2def069df07a7ec64c79ee69e4f278dc4a614

Checks will be approved automatically on success.

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.

2 participants