Dbt: plugin macro name collisions result in unhelpful errors

Created on 1 Apr 2020  路  3Comments  路  Source: fishtown-analytics/dbt

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
  • [X] 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.

bug

All 3 comments

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

fixed by #2293

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!

Was this page helpful?
0 / 5 - 0 ratings