Skip to content

feat: add fusion_compat mode for dbt 1.9.6+ YAML output#317

Open
RicardoAGL wants to merge 5 commits intoz3z1ma:mainfrom
RicardoAGL:feature/fusion-compat
Open

feat: add fusion_compat mode for dbt 1.9.6+ YAML output#317
RicardoAGL wants to merge 5 commits intoz3z1ma:mainfrom
RicardoAGL:feature/fusion-compat

Conversation

@RicardoAGL
Copy link
Contributor

@RicardoAGL RicardoAGL commented Feb 10, 2026

Summary

Adds a fusion_compat mode that produces Fusion-compatible YAML output where column-level meta and tags are nested inside config: blocks, as required by dbt >= 1.9.6 and dbt Fusion.

  • Auto-detection: when fusion_compat is not explicitly set, it auto-detects from: (1) Fusion manifest in target/ (schema version > v12), (2) Fusion binary on PATH, (3) dbt-core version >= 1.9.6
  • CLI flags: --fusion-compat / --no-fusion-compat on yaml refactor, yaml organize, and yaml document
  • Backwards compatible: dbt < 1.9.6 users see no change (classic format preserved)

Note: dbt-osmosis requires dbt-core and does not run on dbt Fusion directly. Teams using Fusion need a hybrid setup with two virtual environments.

What changed

Area Change
settings.py Tri-state fusion_compat field + resolved property on YamlRefactorContext
config.py is_dbt_v1_9_6_or_greater version flag + _detect_fusion_manifest() for Fusion manifest/binary detection
cli/main.py --fusion-compat/--no-fusion-compat Click flag
sync_operations.py When enabled: pushes top-level meta/tags INTO config block. When disabled: pulls config.meta UP to top-level
restructuring.py _generate_minimal_model_yaml / _generate_minimal_source_yaml respect fusion_compat
inheritance.py Knowledge graph reads/merges from both meta and config.meta paths transparently
schema/parser.py Allows data_tests as a top-level key
schema/writer.py Preserves anchors section during writes (via _PRESERVED_KEYS)
schema/validation.py Accepts both tests and data_tests column keys
docs/ CLI reference, settings reference, configuration tutorial updated with fusion-compat docs and hybrid workflow guide

Issues addressed

Test coverage

  • 660 total tests passing (including test_generators.py), 6 skipped
  • Integration tests pass (yaml organize, yaml document, yaml refactor)
  • Pre-commit clean (all 12 hooks pass)

Test plan

  • Verify --fusion-compat produces config.meta/config.tags at column level
  • Verify --no-fusion-compat keeps meta/tags at top level (classic)
  • Verify omitting the flag auto-detects from dbt version
  • Run pytest - 660 passed, 6 skipped
  • Run bash demo_duckdb/integration_tests.sh - all passed

Auto-detect dbt version and produce Fusion-compatible YAML when
column-level config is supported (dbt >= 1.9.6). When enabled,
meta/tags are nested under config blocks instead of top-level.
Adds --fusion-compat/--no-fusion-compat CLI flags for override.
Also preserves anchors, data_tests, and semantic_models in YAML.
Fix 17 pre-existing test failures:
- Pass DbtProjectContext (yaml_context.project) instead of YamlRefactorContext
  to generator functions that expect the project context directly
- Fix mock.patch paths for lazy imports: mock at dbt_core_interface.* instead
  of dbt_osmosis.core.generators.* for classes imported inside functions
- Use tmp_path instead of absolute /custom/staging to avoid read-only filesystem
Detect dbt Fusion manifests (schema version > v12) in the target
directory before parsing, so teams running both Fusion and dbt-core
get fusion_compat=True automatically even with older dbt-core versions.

Detection also checks for dbtf/dbt-fusion binaries on PATH as a
fallback when no manifest exists. The explicit --fusion-compat flag
still takes priority over all auto-detection.
- Document --fusion-compat/--no-fusion-compat in CLI reference, settings
  reference, and configuration tutorial
- Add disclaimer that dbt-osmosis requires dbt-core and does not run on
  dbt Fusion directly, with hybrid workflow instructions
- Anchor schema version regex to path segment to avoid false matches
- Optimize manifest reading to parse only first 4KB instead of full JSON
- Downgrade Fusion binary detection log from info to debug
- Remove anchors from parser allowed_keys (preserved via writer only)
- Simplify single-element tuple filters to != comparisons
- Remove unused json import from config.py
The fusion-compat setting is only available via CLI flag or
auto-detection. The project vars path is not wired up in
YamlRefactorContext, so the example was misleading.
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.

1 participant