Hi, I've hit a wall when trying to add dimension a...
# community-support
t
Hi, I've hit a wall when trying to add dimension anomaly tests to my models, I'm getting the following error, and not sure what to do:
Copy code
09:42:11  Encountered an error:
Runtime Error
  Compilation Error in test elementary_dimension_anomalies_member_IS_MEMBER__day__1__MEMBER_CREATED_AT (models/semantic/sources.yml)
    Test 'test.my_data_vault.elementary_dimension_anomalies_member_IS_MEMBER__day__1__MEMBER_CREATED_AT.6a3ae7c932' (models/semantic/sources.yml) depends on a node named 'monitors_runs' in package 'my_data_vault' which was not found
    
    > in macro ref (macros/overrides.sql)
    > called by macro ref (macros/overrides.sql)
    > called by macro test_dimension_anomalies (macros/edr/tests/test_dimension_anomalies.sql)
    > called by test elementary_dimension_anomalies_member_IS_MEMBER__day__1__MEMBER_CREATED_AT (models/semantic/sources.yml)
Could you please advise?
dbt version: 1.5 database: snowflake
The forced dependencies in the tests might be causing this, I think that because they don't specify the project name for the
ref
macro call. For now I could fix the issue with an override:
Copy code
{% macro ref() %}
   {% if varargs[0] == "monitors_runs" %}
   {{ return(builtins.ref("elementary", "monitors_runs")) }}
   {% elif varargs[0] == "data_monitoring_metrics" %}
   {{ return(builtins.ref("elementary", "data_monitoring_metrics")) }}
   {% elif varargs[0] == "dbt_run_results" %}
   {{ return(builtins.ref("elementary", "dbt_run_results")) }}
   {% else %}
   {{ return(builtins.ref(*varargs, **kwargs)) }}
   {% endif %}
{% endmacro %}
s
looks to me like there's a conflict between versions of the
monitors_runs
macro
between
my_data_vault
and
elementary
I was just wondering idly what the right solution for this problem is the other day--the best I came up with is a manual override of the macro that preserves the relevant logic from the conflicting packages but that is a brittle solution and isn't resilient to changes from package upgrades
o
Hi @Tamas Szenczi, did you run
dbt run -s elementary
?
t
Hi @Ofek Weiss, Yes I used that too.
o
Interesting, care to share your
sources.yml
file which contains this test? also a
dbt.log
file will be helpful (in a DM its great if you prefer). also, do you, by any chance, have a model/source/seed named "monitors_runs" in your dbt project?
t
> do you, by any chance, have a model/source/seed named "monitors_runs" in your dbt project? no I don't have anything like that I'll try to recreate the problem in a separate dbt project and I'll send it in DM to you
o
Great, ill be waiting 🙏
h
👋 is there a solution for this error? we got a same one while executing the
dbt docs generate
command on a volume anomalies test thanks
Copy code
dbt-local dbt docs generate --profiles-dir /work/profiles --project-dir /work/projects/example --target local_machine
09:40:39  Running with dbt=1.5.7
09:40:39  Registered adapter: snowflake=1.5.5
09:40:40  Unable to do partial parsing because saved manifest not found. Starting full parse.
09:41:01  Found 232 models, 1903 tests, 17 snapshots, 0 analyses, 1292 macros, 3 operations, 6 seed files, 39 sources, 0 exposures, 0 metrics, 0 groups
09:41:01  
09:41:05  Concurrency: 15 threads (target='local_machine')
09:41:05  
09:41:19  Encountered an error:
Runtime Error
  Compilation Error in test elementary_volume_anomalies_linked_partner_activity_drop__day__7 (models/transform/accounts/models/linked_partner_activity.yml)
    Test 'test.example.elementary_volume_anomalies_linked_partner_activity_drop__day__7.ca2fa7df78' (models/transform/accounts/models/linked_partner_activity.yml) depends on a node named 'monitors_runs' in package 'example' which was not found
    
    > in macro ref (macros/overrides.sql)
    > called by macro ref (macros/ref.sql)
    > called by macro test_volume_anomalies (macros/edr/tests/test_volume_anomalies.sql)
    > called by test elementary_volume_anomalies_linked_partner_activity_drop__day__7 (models/transform/accounts/models/linked_partner_activity.yml)
o
Hi @Hong Zhang, do you overwrite the
ref
macro by any chance?
h
hi @Ofek Weiss no i dont overwrite any macro
actually same error from dbt test too
o
the reason im asking is because of these lines in your output
``` > in macro ref (macros/overrides.sql)
> called by macro ref (macros/ref.sql)```
are you 100% sure that you do not overwrite it? maybe a package you use does? - what packages are you using in your project?
👀 1
h
sorry … found the macro overwrite in our project
Copy code
{% macro ref(model_name) %}
   {{ return(dbt_unit_testing.ref(model_name)) }}
{% endmacro %}
thanks for your help
o
Yea thats the bug that @Tamas Szenczi encountered, we talked about it in DM's and he came up with this workaround:
Copy code
{% macro ref() %}
    {% if varargs[0] in [
        "schema_columns_snapshot",
        "monitors_runs",
        "data_monitoring_metrics",
        "dbt_run_results",
        "dbt_run_results",
    ] %}
        {{ return(dbt_unit_testing.ref("elementary", varargs[0])) }}
    {% else %}
        {{ return(dbt_unit_testing.ref(*varargs, **kwargs)) }}
    {% endif %}
{% endmacro %}
❤️ 1