-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Bug] AttributeError: 'Getattr' object has no attribute 'name' 1.10.0-a1 in _get_doc_blocks
during parsing
#11275
Comments
@MisterWheatley Thanks for opening! I think this was an unintended consequence of this change: It's not strictly documented / guaranteed that you can call models:
- name: my_model
description: "{{ 'some string with {test_name}'.format(test_name = 'abc') }}" The problem is that this is a callable ( dbt-core/core/dbt/parser/manifest.py Lines 1671 to 1676 in 2cde93b
I think we avoid the exception by adding an extra line of defense: if (
isinstance(node, Call)
and hasattr(node, "node")
and hasattr(node, "args")
#
and hasattr(node.node, "name")
and node.node.name == "doc"
): But we need to make sure that the original repro case passes — a call to a doc block and a call to cc @zqureshi |
@MisterWheatley Thanks for the prompt and detailed bug report! I've rolled back the change in dbt Cloud, so if you restart your IDE this issue should not reoccur. I'm going to work on a fix for this issue in the next few days, which will go out to dbt Cloud next week. Thanks once again, and let me know if you have further issues. |
@aranke and @jtcohen6 Thanks for the fast follow up and appreciate the further investigation. If you need anything further from me, please don't hesitate to reach out. In terms of not being guaranteed to use string formatting in doc blocks, it might be worth investigating an extension of the existing doc block that looks something like:
to provide the functionality in an official way, but I am not familiar enough with the deep internal workings to evaluate the effort needed to do this. Incidentally, I don't think that the two argument form of doc block macro usage is documented anywhere (i.e. using a doc block from a package) |
Is this a new bug in dbt-core?
Current Behavior
I believe there is a simple bug in the following line when interacting with an edge case involving templated doc blocks.
dbt-core/core/dbt/parser/manifest.py
Line 1675 in 5f873da
This crashes the parsing of the manifest.
Expected Behavior
The project to be able to parse and use templated doc blocks as before.
Steps To Reproduce
Create templated doc block
Use in model docs as follows:
Relevant log output
Environment
Which database adapter are you using with dbt?
bigquery
Additional Context
I believe this might be an un-expected edge-case/behaviour and if that is the case, then please just confirm that.
The text was updated successfully, but these errors were encountered: