Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbt found two macros with the name "test_unique" in the namespace "dbt" #2423

Closed
mingkezhou opened this issue May 9, 2020 · 8 comments
Closed
Labels
adapter_plugins Issues relating to third-party adapter plugins bug Something isn't working

Comments

@mingkezhou
Copy link

Describe the bug

When run dbt run or dbt test, it always say dbt found two macros with the name "test_unique" in the namespace "dbt", but there is only one file.
tried install and installl dbt and python and dbt-sqlserver which didn't work
dbt test
Running with dbt=0.16.1
Encountered an error:
Compilation Error
dbt found two macros with the name "test_unique" in the namespace "dbt". Since these macros have the same name and exist in the same namespace, dbt will be unable to decide which to call. To fix this, change the name of one of these macros:

  • macro.dbt_sqlserver.test_unique (macros\schema_tests.sql)
  • macro.dbt_sqlserver.test_unique (macros\schema_tests.sql)

Steps To Reproduce

Installed dbt
installed dbt-sqlserver
create dbt sqlserver connection
then run dbt test or dbt test. the got the error

Expected behavior

I should not see this duplicate error

Screenshots and log output

If applicable, add screenshots or log output to help explain your problem.

System information

Which database are you using dbt with?
sql-server

The output of dbt --version:
installed version: 0.16.1
latest version: 0.16.1

Up to date!


**The operating system you're using:**
windows 10 pro

**The output of `python --version`:**
Python 3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)] on win32



Up to date!
### Additional context
Add any other context about the problem here.
@mingkezhou mingkezhou added bug Something isn't working triage labels May 9, 2020
@jtcohen6 jtcohen6 removed the triage label May 9, 2020
@jtcohen6
Copy link
Contributor

jtcohen6 commented May 9, 2020

Which version of dbt-sqlserver are you using?

The most recent stable release is 0.15.1, which needs to be run alongside the 0.15.1 version of dbt core. It looks like you're running dbt version 0.16.1. I think you'll want to downgrade to use the 0.15.1 versions of both dbt and the dbt-sqlserver plugin until there is a new stable release.

In the next minor release of dbt (0.17.0):

  • This discrepancy will be clearer by including plugin versions in the printout of dbt --version
  • We've just merged a change to supports a new version of the community-supported dbt-sqlserver plugin (alias for schema tests macros #2414)

We have some additional ideas about making this specific problem easier to spot (#2288) and resolve (#2415) in the future.

@ramgopalan
Copy link

Hi,

Facing the same issue in dbt 17.0 version, any quick fix for 17 version?

@drewbanin
Copy link
Contributor

@ramgopalan are you also using dbt-sqlserver?

@ramgopalan
Copy link

Yeah @drewbanin

@ramgopalan
Copy link

Hi @drewbanin Any updates?

@drewbanin
Copy link
Contributor

I think the real fix here is to implement the change described in #2415. This is not something we can really "quick-fix" in dbt Core.

I might be misunderstanding, but I think the issue is that dbt-sqlserver is built to target dbt Core v0.15.x, but it sounds to me like your environment is using dbt v0.16.1. One helpful change might be for the maintainer of dbt-sqlserver to change their requirements for the package from >=0.15.0 to something like >=0.15.0, <0.16.

An alternative fix you can implement might be to run:

pip install dbt==0.15.2 dbt-sqlserver==0.15.2

This will make sure that you get the right version of dbt Core in your environment.

Again, I might be missing something here, so please let me know if the thing I'm saying doesn't make any sense :)

@alittlesliceoftom
Copy link

alittlesliceoftom commented Jun 29, 2020

Hi @drewbanin thanks for your solution.

I just tried this solution (previously dbt v0.17) and it does work correctly (after realising I really needed to use venvs and not my default conda envs for this).

I have raised an issue on the community plugin for the same. (dbt-msft/dbt-sqlserver#31).

It would be helpful for future users perhaps to have a version incompatible warning to help out in these kind of situations as the error itself is obviously rather confusing.

@jtcohen6
Copy link
Contributor

jtcohen6 commented Dec 3, 2020

Closing this issue, as I believe it was ultimately resolved by using adapter.dispatch within schema test definitions

@jtcohen6 jtcohen6 closed this as completed Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapter_plugins Issues relating to third-party adapter plugins bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants