Skip to content

[Bug] partial parsing error when updating a model (with a schema file) which is used in a singular test (new in v1.10.14) #12223

@mattogburke

Description

@mattogburke

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

Partial parsing raised an exception when it encounters a changed model with a singular test because singular tests do not have attached_node attributes. dbt then falls back to a full parse.

16:45:00 PP exception info: {'exception': "AttributeError: 'SingularTestNode' object has no attribute 'attached_node'", 'code': 'if child_test.attached_node:', 'parse_file_type': 'schema', 'traceback': 'Traceback (most recent call last):\n File "/home/dbtuser/.local/share/pipx/venvs/dbt-monzo/lib/python3.12/site-packages/dbt/parser/manifest.py", line 545, in safe_update_project_parser_files_partially\n project_parser_files = self.partial_parser.get_parsing_files()\n ...

Expected Behavior

Partial parsing does not error when it encounters this scenario.

Steps To Reproduce

  1. have a sql model with a yml resource file + a sql singular test that reference the model
  2. fully parse the project
  3. modify the model
  4. attempt to partially parse the project
  5. error occurs

Relevant log output

Environment

- OS: Debian
- Python: 3.12
- dbt: v1.10.14 and v1.10.15 (but not earlier versions inc v1.10.13)

Which database adapter are you using with dbt?

bigquery

Additional Context

Appears to have been introduced by this backported change: #12060

The check here (https://github.com/dbt-labs/dbt-core/pull/12060/files#diff-2fd42940aaee0e200a257863155b747faf735f6b49ae49ac9229c17be33db82aR920) should be guarded with a check that the node is a GenericTest and not a SingularTest (all other instances of checking for attached_nodes in the codebase do this already).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions