Skip to content

fix: suppress use_managed_iceberg warning for non-Iceberg projects#1429

Open
tejassp-db wants to merge 8 commits intomainfrom
fix-use_managed_iceberg-warning
Open

fix: suppress use_managed_iceberg warning for non-Iceberg projects#1429
tejassp-db wants to merge 8 commits intomainfrom
fix-use_managed_iceberg-warning

Conversation

@tejassp-db
Copy link
Copy Markdown
Collaborator

@tejassp-db tejassp-db commented Apr 28, 2026

Summary

Fixes #1266.

dbt-core's BehaviorFlag emits a deprecation warning the first time a flag with default=False is read. As a result, every dbt run — even on Delta-only projects with zero Iceberg models — logged a confusing use_managed_iceberg warning, with no clean way to silence it short of opting in to the flag itself.

This PR fixes this by accessing the flag with non_warn in the code paths. Also flipped the order of comparison in the jinja macro, now warning fires only if its a iceberg model and use_managed_icerberg is set to false.

PECOBLR-2638

…1266)

dbt-core's BehaviorFlag machinery emits a deprecation warning the first
time a flag with default=False is read. As a result, every dbt run
even on Delta-only projects with zero Iceberg models logged a
confusing use_managed_iceberg warning.

Two-part fix that suppresses the warning everywhere except where it is
actionable:

- Python: add a `get_behavior_flag_no_warn` helper that reads the flag
  via the `.no_warn` property (which bypasses the BehaviorChangeEvent),
  and route all internal accesses of `use_managed_iceberg` through it.
- Jinja: in `file_format.sql`, evaluate `table_format == 'iceberg'`
  before `adapter.behavior.use_managed_iceberg` so non-Iceberg models
  short-circuit before reading the flag.

Resulting matrix:

  No Iceberg models           → no warning (Jinja short-circuits)
  Iceberg + flag false/unset  → warning (the only actionable case)
  Iceberg + flag true         → no warning (dbt-core does not fire it)

Tests:
- Fix 5 stale tests that overwrote the rendered flag with a raw bool by
  switching to `.setting = bool`, so the helper can still read `.no_warn`.
- Add a `TestFileFormatClause` exploding-property regression test that
  fails immediately if the macro reads the flag for a non-Iceberg
  relation.
- Add `test_is_uniform_does_not_fire_managed_iceberg_event`, mirroring
  the existing microbatch event-capture pattern.
@tejassp-db tejassp-db self-assigned this Apr 28, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  dbt/adapters/databricks
  impl.py 268, 771-772
Project Total  

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

Copy link
Copy Markdown
Collaborator

@sd-db sd-db left a comment

Choose a reason for hiding this comment

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

Overall change looks good, recommended some changes w.r.t tests.Additionally I have made some nit comments in the code which are more of a FYI though and not a need to address.

Comment thread tests/functional/adapter/iceberg/test_managed_iceberg_warning.py Outdated
Comment thread dbt/adapters/databricks/impl.py
Comment thread dbt/adapters/databricks/impl.py Outdated
Comment thread tests/unit/test_adapter.py Outdated
@tejassp-db tejassp-db changed the title fix: suppress use_managed_iceberg warning for non-Iceberg projects (#… fix: suppress use_managed_iceberg warning for non-Iceberg projects Apr 29, 2026
Copy link
Copy Markdown
Collaborator

@sd-db sd-db left a comment

Choose a reason for hiding this comment

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

Changes look good, have triggered integration tests.

@sd-db
Copy link
Copy Markdown
Collaborator

sd-db commented Apr 29, 2026

/integration-test

@github-actions
Copy link
Copy Markdown

Integration tests dispatched for PR #1429 by @sd-db. Track progress in the Actions tab.

@github-actions
Copy link
Copy Markdown

Integration results for PR #1429 — UC cluster ❌ failure · SQL warehouse ✅ success · All-purpose cluster ❌ failure

Run details.

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.

use_managed_iceberg warning popping up for projects that don't use iceberg at all

2 participants