-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[CT-1483] [Bug] Macros whose names contain "materialization" treated as materialization macros by compiler, fail with "no supported_languages..." #6231
Comments
Thanks for surfacing this @CraftyIvan ! Agreed that this is a surprising result when there is a non-materialization macro that happens to have "materialization" within the name. Our next step will be to determine what our options are for changing the implementation. |
Goal
Idea for resolution@stu-k I saw you worked on this area of the code -- do you know if we could do something like the following? If not, do you have any other suggestions? Replace: dbt-core/core/dbt/parser/macros.py Lines 87 to 90 in 9f280a8
with something like: # get supported_languages for materialization macro
if block.block_type_name == "materialization":
node.supported_languages = jinja.get_supported_languages(macro)
yield node |
@dbeatty10 Your suggested change makes sense to me! Much better than the idea I was halfway through typing. I'm going to tag this one for |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days. |
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers. |
please reopen this ticket, now we have version 1.5.2 and it is still not fixed :( |
Given how straightforward Doug's proposed fix is, I think this could be a community contribution. @mjedrzejczak-wh Any interest in giving it a spin? |
@jtcohen6 unfortunately we have in our projects such macros, which block us effectively from upgrade and I would prefer not to fix this myself - I do not know dbt internals so well |
@jtcohen6 @mjedrzejczak-wh @dbeatty10 @CraftyIvan @joevandyk Just FYI, I too faced the same error while trying to upgrade dbt. I did try the code change suggested by @dbeatty10 locally in my python virtual environment and it is working as expected. I am facing some other project specific errors but thought to share this here so that we are all aware that the idea proposed above is fixing the issue. |
I need to make materializations depend on a variable and this bug prevents me from giving the macro a correct name. Besides, the error is very confusing. |
@fconrady it is already fixed and closed, update your dbt :) |
Is this a new bug in dbt-core?
Current Behavior
After upgrading to dbt 1.3.0 which adds
supported_languages
for materialization macros (#5695), all standard macros whose name has"materlialization"
as a substring prevent compilation.A project I'm contributing to contains a macro named
get_materialization
(it defaults model materializations to view under certain conditions). The parser seems to treat it as a materialization macro for that, even though it's not (location of this in dbt-core code referenced below in "Additional Context").So when running
dbt run
ordbt compile
I get the following error:Expected Behavior
Only materialization macros are able to trigger this compilation error when not declaring supported languages.
A regular macro (
{% macro_name([params]) %}
) with the substring"materialization"
in its name is not considered a materialization macro ({% materialization [materialization_name] ... %}
) and does not trigger the compilation error.Steps To Reproduce
"materialization"
, e.g.get_materialization
orprint_materialization
.dbt compile
.Relevant log output
No response
Environment
Which database adapter are you using with dbt?
snowflake
Additional Context
The
parse_unparsed_macros
method performs this "generalization":dbt-core/core/dbt/parser/macros.py
Line 88 in f022435
The text was updated successfully, but these errors were encountered: