Skip to content

1.0.8

Latest

Choose a tag to compare

@sfc-gh-dflippo sfc-gh-dflippo released this 13 Jan 21:04
· 7 commits to main since this release
6222f71

Summary

This release adds dbt Fusion compatibility to dbt_constraints, along with a robust Docker-based integration testing framework. The package now works with both traditional dbt-core and the next-generation dbt Fusion engine.

Key Changes

🔧 dbt Fusion Compatibility

1. New get_results_group_by() Utility Macro

  • Replaces Agate's native group_by() function which doesn't work in dbt Fusion
  • Provides a pure Jinja implementation that works identically in both dbt-core and Fusion
  • Updated all adapter macros (Snowflake, Postgres, Oracle, BigQuery, Redshift, Vertica) to use this new utility

2. Fusion Argument Format Handling

  • dbt Fusion nests test arguments under an arguments key in test_metadata.kwargs
  • Added logic to detect and merge this nested format with top-level kwargs
  • Maintains full backward compatibility with dbt-core's flat kwargs structure

3. Safe Meta Attribute Access

  • Changed test_model.config.meta.get() to test_model.config.get("meta", {}).get()
  • Prevents errors when meta is undefined in Fusion's object model

4. Graceful FK Constraint Handling

  • Foreign key constraints with missing parameters now log a warning and skip instead of raising a compiler error
  • This accommodates a known Fusion limitation where test arguments aren't fully preserved in test_metadata.kwargs

🧪 Integration Testing Framework

1. Docker-Based Test Infrastructure

  • Added Docker Compose configurations for all supported databases (Snowflake, Postgres, Oracle, SQL Server)
  • New fusion-runner.yml for testing with dbt Fusion
  • Automated test runner scripts with proper environment handling

2. Reorganized Test Projects

  • Split integration tests into dbt-core/ and dbt-fusion/ subdirectories
  • Each has its own dbt_project.yml, profiles.yml, and test configurations
  • Allows testing both engines with their specific requirements

3. pytest Integration

  • New conftest.py with fixtures for database setup and dbt command execution
  • Support for running tests across multiple dbt versions (1.5.0 - 1.10.0)
  • Configurable test matrix via test-versions.json

Files Changed

Category Files
Core Macros create_constraints.sql, all *__create_constraints.sql adapters
New Test Project integration_tests/dbt-fusion/* (41 files)
Test Infrastructure automated_tests/docker/compose/*.yml, conftest.py, test-versions.json
Documentation README.md files updated

Testing

  • ✅ Snowflake dbt-core 1.9.0 - PASSED
  • ✅ dbt Fusion latest - PASSED

Known Limitations

dbt Fusion currently has a limitation where foreign key test arguments (pk_column_name, fk_column_name, etc.) are not fully exposed in test_metadata.kwargs. This means:

  • Primary key and unique key constraints work correctly
  • Foreign key constraints will be skipped with an informational warning in Fusion

This is a Fusion engine limitation that we've documented and worked around gracefully.

Breaking Changes

None. This release is fully backward compatible with existing dbt-core installations.

New Contributors

Full Changelog: 1.0.7...1.0.8