You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
In core 1.6.0rc1 if you have semantic models and metrics defined, and if a semantic model (that has no default.agg_time_dimension specified) has a measure that doesn't specify a agg_time_dimension then when you run dbt parse you get the error
An error occurred while checking aggregation time dimension for a semantic model - UnboundLocalError: local variable 'default_agg_time_dimesion' referenced before assignment
Expected Behavior
If a semantic model (that has no default.agg_time_dimension specified) has a measure that doesn't specify a agg_time_dimension then when you run dbt parse then a validation issue should be logged
Aggregation time dimension for measure {measure.name} is not set! This should either be set directly on the measure specification in the model, or else defaulted to the primary time dimension in the data source containing the measure.
Steps To Reproduce
Define a measure without a agg_time_dimension on a semantic model which doesn't have a default agg_time_dimension set
Run dbt parse
be sad about an UnboundLocalError
Relevant log output
An error occurred while checking aggregation time dimension for a semantic model - UnboundLocalError: local variable 'default_agg_time_dimesion' referenced before assignment
. Specifically if a semantic model doesn't have defaults defined, and a measure of that semantic model doesn't have an agg_time_dimension we try to set it to the detected default value (which due to the logical error hasn't been bound). It's kind of ironic because we're blowing up on the thing we're trying to detect.
github-actionsbot
changed the title
[Bug] UnboundLocalError: local variable 'default_agg_time_dimesion' referenced before assignment
[CT-2879] [Bug] UnboundLocalError: local variable 'default_agg_time_dimesion' referenced before assignment
Jul 27, 2023
Is this a new bug in dbt-core?
Current Behavior
In core 1.6.0rc1 if you have semantic models and metrics defined, and if a semantic model (that has no default.agg_time_dimension specified) has a measure that doesn't specify a
agg_time_dimension
then when you rundbt parse
you get the errorExpected Behavior
If a semantic model (that has no default.agg_time_dimension specified) has a measure that doesn't specify a
agg_time_dimension
then when you rundbt parse
then a validation issue should be loggedSteps To Reproduce
agg_time_dimension
on a semantic model which doesn't have a defaultagg_time_dimension
setdbt parse
UnboundLocalError
Relevant log output
This happens due to a logical error in
dbt-core/core/dbt/contracts/graph/nodes.py
Line 1571 in fe9c875
defaults
defined, and a measure of that semantic model doesn't have anagg_time_dimension
we try to set it to the detected default value (which due to the logical error hasn't been bound). It's kind of ironic because we're blowing up on the thing we're trying to detect.Which database adapter are you using with dbt?
No response
Additional Context
The fix is to change this if statement to
The text was updated successfully, but these errors were encountered: