dbt found two macros named issue

Hi Community!

I am having come weird issue with dbt project:

dbt compile
Running with dbt=1.7.10
Registered adapter: postgres=1.7.10
Unable to do partial parsing because saved manifest not found. Starting full parse.
Encountered an error:
Compilation Error
dbt found two macros named “test_daily_count_decrease” in the project “xxx”.
To fix this error, rename or remove one of the following macros:
- tests/_default\generic\test_daily_count_decrease.sql
- tests/_default\generic\test_daily_count_decrease.sql

This is pointing to one file and there are no duplicated macroses.

Maybe you have some suggestions?

Additional info:
dbt --version
Core:

  • installed: 1.7.10
  • latest: 1.7.12 - Update available!

Your version of dbt-core is out of date!
You can find instructions for upgrading here:
About dbt Core and installation | dbt Developer Hub

Plugins:

  • postgres: 1.7.10 - Update available!

At least one plugin is out of date or incompatible with dbt-core.
You can find instructions for upgrading here:
https://docs.getdbt.com/docs/installation

Could you paste the file’s content?

sure



{% test daily_count_decrease(model, grouping_columns, date_column ) %}

{% set unique_date_count %}
    SELECT count(distinct {{ date_column }}) AS date_count FROM {{ model }}
    HAVING count(distinct {{ date_column }}) > 1
{% endset %}
{% set date_count = run_query(unique_date_count) %}

{% if date_count | length > 0  %}

WITH grouped_counts AS (
    SELECT
        {{ grouping_columns | join(', ') }},
        {{ date_column }},
        COUNT(*) AS daily_count
    FROM {{ model }}
    GROUP BY {{ grouping_columns | join(', ') }}, {{ date_column }}
)

,ordered_counts AS (
    SELECT
        *,
        LAG(daily_count) over (PARTITION BY {{ grouping_columns | join(', ') }}
        ORDER BY {{ date_column }}) AS previous_count
    FROM grouped_counts
),

validation_logic AS (
SELECT
        SUM(CASE WHEN daily_count < previous_count THEN 1 ELSE 0 END) as count_case
FROM ordered_counts
)

SELECT * FROM validation_logic
WHERE count_case > 0


{% else %}

SELECT FALSE AS always_pass_case
WHERE FALSE

{% endif %}

{% endtest %}

The thing is that if I drop this file i will get same error with other one…and so on…and so on

It seems the same issue reported here

You can see if some of these discussions help, otherwise you can reach out to @doug.beatty in the slack community

1 Like