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

plugin macro name collisions result in unhelpful errors #2288

Closed
1 of 5 tasks
beckjake opened this issue Apr 1, 2020 · 3 comments
Closed
1 of 5 tasks

plugin macro name collisions result in unhelpful errors #2288

beckjake opened this issue Apr 1, 2020 · 3 comments
Labels
bug Something isn't working
Milestone

Comments

@beckjake
Copy link
Contributor

beckjake commented Apr 1, 2020

Describe the bug

If an adapter plugin macro and a macro defined in dbt-core have the same name, dbt gives a bad error:

'ParsedMacro' object has no attribute 'namespace'

This happens because dbt.exceptions.raise_duplicate_macro_name accesses macro_1.namespace. It should be macro_1.name.

Steps To Reproduce

Create an adapter plugin with a macro that has a name the same as one in core (or another plugin). For example, is_incremental. Install that plugin, run dbt.

Expected behavior

I should get an error indicating that two macros that ended up in the same namespace have the same name.

Screenshots and log output

N/A

System information

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: any custom adapter)

The output of dbt --version:

0.16.0

The operating system you're using:
any

The output of python --version:
any

Additional context

This issue is a real pain to surface and writing a real integration test for it would be a real chore, but we could at least unit test it!

I would like to get this into 0.16.1, if possible. It's a small fix and buggy error handling is always embarrassing.

@beckjake beckjake added bug Something isn't working triage labels Apr 1, 2020
@drewbanin drewbanin removed the triage label Apr 2, 2020
@drewbanin drewbanin added this to the 0.16.1 milestone Apr 2, 2020
@drewbanin
Copy link
Contributor

@beckjake just added this to the 0.16.1 milestone if you think we can sneak it in!

beckjake added a commit that referenced this issue Apr 3, 2020
…-macros

Fix an error in exception handling for duplicate macros (#2288)
@drewbanin
Copy link
Contributor

fixed by #2293

@curious-bryan
Copy link

curious-bryan commented Apr 13, 2020

For what it is worth, I ran into this problem today with a fresh install of dbt 0.16.0 and dbt-sqlserver adapter (0.15.1). Thanks @beckjake for finding this and fixing it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants