dbt-labs / dbt-core

dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications.
https://getdbt.com
Apache License 2.0
9.68k stars 1.61k forks source link

[Bug] Unhelpful exception occurs with yaml file in list format #10284

Closed gshank closed 3 months ago

gshank commented 3 months ago

Description

If dbt reads a yaml file in list format such as:

- name: my_name
- name: alt_name

then an exception occurs:

File "/.../core/dbt/parser/schemas.py", line 123, in yaml_from_file for source in contents.get("sources", []):

The code in parser/schemas.py is expecting a dictionary and doesn't handle a list in a user-friendly way.

Acceptance Criteria

Instead of unfriendly exception, we issue a better error message.

MichelleArk commented 3 months ago

I've definitely ran into this before and spent too long debugging. Thank you! ❤️