Skip to content

dbt-materialize: support unmanaged clusters in deploy_init#36625

Merged
sjwiesman merged 3 commits into
MaterializeInc:mainfrom
sjwiesman:dbt
May 20, 2026
Merged

dbt-materialize: support unmanaged clusters in deploy_init#36625
sjwiesman merged 3 commits into
MaterializeInc:mainfrom
sjwiesman:dbt

Conversation

@sjwiesman
Copy link
Copy Markdown
Contributor

The deploy_init macro previously hard-failed when the production cluster was unmanaged, blocking blue/green deployments for any Materialize user not on a managed cluster. Add a dispatch path that, for unmanaged origins, queries mz_cluster_replicas and emits CREATE CLUSTER ... REPLICAS (...) cloning each user-facing replica's SIZE and AVAILABILITY ZONE. Internal replicas are filtered via mz_internal_cluster_replicas. Replicas without a SIZE (orchestrated replicas using COMPUTECTL/STORAGECTL ADDRESSES) cannot be faithfully cloned and now produce a compiler error that names the offending replica.

The new create_unmanaged_cluster macro mirrors the structure of the existing create_cluster macro (pre-existence check, CI tag re-entry, DDL emission, CI tag set) so the managed path is untouched.

Remove these sections if your commit already has a good description!

Motivation

Why does this change exist? Link to a GitHub issue, design doc, Slack
thread, or explain the problem in a sentence or two. A reviewer who has
no context should understand why after reading this section.

If this implements or addresses an existing issue, it's enough to link to that:
Closes
Fixes
etc.

Description

What does this PR actually do? Focus on the approach and any non-obvious
decisions. The diff shows the code --- use this space to explain what the
diff can't tell a reviewer.

Verification

How do you know this change is correct? Describe new or existing automated
tests, or manual steps you took.

The deploy_init macro previously hard-failed when the production cluster
was unmanaged, blocking blue/green deployments for any Materialize user
not on a managed cluster. Add a dispatch path that, for unmanaged
origins, queries mz_cluster_replicas and emits CREATE CLUSTER ...
REPLICAS (...) cloning each user-facing replica's SIZE and AVAILABILITY
ZONE. Internal replicas are filtered via mz_internal_cluster_replicas.
Replicas without a SIZE (orchestrated replicas using
COMPUTECTL/STORAGECTL ADDRESSES) cannot be faithfully cloned and now
produce a compiler error that names the offending replica.

The new create_unmanaged_cluster macro mirrors the structure of the
existing create_cluster macro (pre-existence check, CI tag re-entry,
DDL emission, CI tag set) so the managed path is untouched.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@sjwiesman sjwiesman requested a review from a team as a code owner May 19, 2026 18:52
Comment thread misc/dbt-materialize/CHANGELOG.md Outdated

* Support unmanaged origin clusters in `deploy_init`. The deployment
cluster is now created by cloning the production cluster's replicas
(including SIZE and AVAILABILITY ZONE attributes). Internal replicas
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.

Tiny nit: "Internal replicas are skipped" might confuse users who don't know what counts as internal. Worth a quick clarifier, or fine to leave?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

dropped.

@sjwiesman
Copy link
Copy Markdown
Contributor Author

@bobbyiliev thank you for the speedy review. I believe I've addressed your comments.

Copy link
Copy Markdown
Contributor

@bobbyiliev bobbyiliev left a comment

Choose a reason for hiding this comment

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

Looks good! There seem to be some minor lint CI failures but should be good to go after that.

@sjwiesman sjwiesman enabled auto-merge (squash) May 20, 2026 16:03
@sjwiesman sjwiesman disabled auto-merge May 20, 2026 16:13
@sjwiesman sjwiesman enabled auto-merge (squash) May 20, 2026 16:13
@sjwiesman sjwiesman merged commit 40be6ed into MaterializeInc:main May 20, 2026
5 checks passed
sjwiesman added a commit that referenced this pull request May 20, 2026
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