[Bug] can't override namespaced macros for unit testing #9624
Labels
bug
Something isn't working
High Severity
bug with significant impact that should be resolved in a reasonable timeframe
pre-release
Bug not yet in a stable release
unit tests
Issues related to built-in dbt unit testing functionality
Milestone
Is this a new bug in dbt-core?
Current Behavior
I have a model called
stg_payments
that uses{{ dbt.current_timestamp() }}
:I try to unit test this model with an override for
current_timestamp
:My unit test fails because the
current_timestamp
macro is not overridden.I get the same failure when I try:
Current workaround
If I instead don't use
dbt.
in front of mycurrent_timestamp()
macro, the unit test succeeds as expected:But this SQL goes against our documentation which tells you to use the
current_timestamp()
macro within your dbt SQL files like this:This also prevents you from being able to override macros from other namespaces (like imported packages). :(
Expected Behavior
I should be able to override namespaced macros (
dbt.
,dbt_utils.
, etc.) in my unit test definition.Which database adapter are you using with dbt?
snowflake
The text was updated successfully, but these errors were encountered: