Skip to content

fix: prevent spurious MicrobatchConcurrency warning on every run (#1406)#1409

Open
sd-db wants to merge 2 commits intomainfrom
sd-db/fix/microbatch-concurrency-spurious-warning
Open

fix: prevent spurious MicrobatchConcurrency warning on every run (#1406)#1409
sd-db wants to merge 2 commits intomainfrom
sd-db/fix/microbatch-concurrency-spurious-warning

Conversation

@sd-db
Copy link
Copy Markdown
Collaborator

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

Fixes #1406.

supports(Capability.MicrobatchConcurrency) read the use_concurrent_microbatch behavior flag via bool(...), which goes through the warning-firing BehaviorFlagRendered.setting path. dbt-core probes this capability on every parse (via check_forcing_batch_concurrency), so the one-shot BehaviorChangeEvent fired on every run regardless of whether the project contained microbatch models — breaking --warn-error builds.

Read via .no_warn instead — same gating, no event.

Test plan

  • hatch run unit → 742 passed, 0 regressions
  • New test_microbatch_concurrency_probe_does_not_warn

dbt-core probes adapter.supports(MicrobatchConcurrency) during every
manifest parse — Manifest.use_microbatch_batches returns True whenever
the microbatch macro is built-in (always on dbt-core 1.9+), independent
of whether any project model uses microbatch. Reading the behavior flag
via bool() fires the one-shot BehaviorChangeEvent on that probe, surfacing
a [WARNING] on every run even for projects without microbatch models,
which breaks builds using --warn-error.

Read via .no_warn so the probe does not fire the event. Update the
companion test to set .setting = True instead of shadowing the flag
object, and add a regression test guarding against the re-introduction.

Co-authored-by: Isaac
@github-actions
Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  dbt/adapters/databricks
  impl.py 267
Project Total  

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

@sd-db sd-db self-assigned this Apr 22, 2026
Copy link
Copy Markdown
Collaborator

@tejassp-db tejassp-db left a comment

Choose a reason for hiding this comment

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

It would be nice if there is a abstraction to track behavior flags, and the silenced ones are always called with .no_warn.

if capability == Capability.MicrobatchConcurrency:
return bool(self.behavior.use_concurrent_microbatch)
# `.no_warn` avoids a BehaviorChangeEvent on dbt-core's per-parse probe.
return self.behavior.use_concurrent_microbatch.no_warn
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there any way around using use_concurrent_microbatch such that it is more tightly tied with the declared behavior flags. Right now it is a property name which has to match what was defined earlier in USE_CONCURRENT_MICROBATCH.name.

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.

MicrobatchConcurrency warning emitted even when no microbatch models are present

2 participants