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

[Bug] AttributeError: 'Getattr' object has no attribute 'name' 1.10.0-a1 in _get_doc_blocks during parsing #11275

Open
2 tasks done
MisterWheatley opened this issue Feb 5, 2025 · 0 comments
Labels
bug Something isn't working triage

Comments

@MisterWheatley
Copy link

MisterWheatley commented Feb 5, 2025

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

I believe there is a simple bug in the following line when interacting with an edge case involving templated doc blocks.

and node.node.name == "doc"

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

  • Install v.1.10.0-a1 version
    Create templated doc block
{% docs test_doc %}
This is a test for {test_name}
{% enddocs %}

Use in model docs as follows:

version: 2
models:
  - name: my_model
    description: "{{ docs('test_doc').format(test_name = 'abc') }}"

Relevant log output

Directly from dbt Cloud IDE:

08:54:33 Traceback (most recent call last):
  File "/venv/dbt-sha-fea52c8b2d6f9cd66a57fc334c198c23887d533f/lib/python3.11/site-packages/dbt/cli/requires.py", line 223, in wrapper
    result, success = func(*args, **kwargs)
                      ^^^^^^^^^^^^^^^^^^^^^
  File "/venv/dbt-sha-fea52c8b2d6f9cd66a57fc334c198c23887d533f/lib/python3.11/site-packages/dbt/cli/requires.py", line 133, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/venv/dbt-sha-fea52c8b2d6f9cd66a57fc334c198c23887d533f/lib/python3.11/site-packages/dbt/cli/requires.py", line 335, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/venv/dbt-sha-fea52c8b2d6f9cd66a57fc334c198c23887d533f/lib/python3.11/site-packages/dbt/cli/requires.py", line 362, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/venv/dbt-sha-fea52c8b2d6f9cd66a57fc334c198c23887d533f/lib/python3.11/site-packages/dbt/cli/requires.py", line 414, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/venv/dbt-sha-fea52c8b2d6f9cd66a57fc334c198c23887d533f/lib/python3.11/site-packages/dbt/cli/requires.py", line 430, in wrapper
    setup_manifest(
  File "/venv/dbt-sha-fea52c8b2d6f9cd66a57fc334c198c23887d533f/lib/python3.11/site-packages/dbt/cli/requires.py", line 479, in setup_manifest
    ctx.obj["manifest"] = parse_manifest(
                          ^^^^^^^^^^^^^^^
  File "/venv/dbt-sha-fea52c8b2d6f9cd66a57fc334c198c23887d533f/lib/python3.11/site-packages/dbt/parser/manifest.py", line 2172, in parse_manifest
    manifest = ManifestLoader.get_full_manifest(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/dbt-sha-fea52c8b2d6f9cd66a57fc334c198c23887d533f/lib/python3.11/site-packages/dbt/parser/manifest.py", line 330, in get_full_manifest
    manifest = loader.load()
               ^^^^^^^^^^^^^
  File "/venv/dbt-sha-fea52c8b2d6f9cd66a57fc334c198c23887d533f/lib/python3.11/site-packages/dbt/parser/manifest.py", line 490, in load
    self.process_docs(self.root_project)
  File "/venv/dbt-sha-fea52c8b2d6f9cd66a57fc334c198c23887d533f/lib/python3.11/site-packages/dbt/parser/manifest.py", line 1299, in process_docs
    _process_docs_for_node(ctx, node, self.manifest)
  File "/venv/dbt-sha-fea52c8b2d6f9cd66a57fc334c198c23887d533f/lib/python3.11/site-packages/dbt/parser/manifest.py", line 1765, in _process_docs_for_node
    column.doc_blocks = _get_doc_blocks(column.description, manifest, node.package_name)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/dbt-sha-fea52c8b2d6f9cd66a57fc334c198c23887d533f/lib/python3.11/site-packages/dbt/parser/manifest.py", line 1731, in _get_doc_blocks
    and node.node.name == "doc"
        ^^^^^^^^^^^^^^
AttributeError: 'Getattr' object has no attribute 'name'

Environment

- OS: N/A
- Python: 3.11
- dbt: 1.10.0-a1

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.

@MisterWheatley MisterWheatley added bug Something isn't working triage labels Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

1 participant