Feature Request: Enable Config and/or Meta Access in Model Tests #10900
DominikGolebiewski
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
Currently, tests in dbt (both model-level and column-level) cannot directly access model configurations or meta configurations during runtime using
config.get()
orconfig.meta.get()
. While the model SQL itself can access these configurations, this functionality is not available in any test context. This limitation requires developers to implement workarounds using custom macros to access model configurations in tests.Current Behavior
When trying to access model configurations in tests (both model and column-level), the config context is not available:
Current workarounds require creating custom macros to access the graph object:
Proposed Solution
Enable direct access to model configurations and meta configurations in all test contexts using the same syntax available in model SQL files. This would allow:
Use Cases
Benefits
Implementation Considerations
Example Implementation
Model configuration:
Proposed test usage:
Alternative Approaches Considered
These alternatives either don't provide the same level of granularity or introduce unnecessary complexity.
Additional Context
This feature would align with dbt's goal of making data testing more accessible and maintainable. It would reduce the need for custom macros and make test configurations more consistent across projects.
Beta Was this translation helpful? Give feedback.
All reactions