This repository has been archived by the owner on Dec 4, 2024. It is now read-only.
Improve error messages; fix errant 500 error #97
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: going to see if we can make this kind of change in Core, as i think that's a better home for this kind of logic...
Two changes here:
Error message diff
Big idea here: the
resource_type
,unique_id
,path
, andname
of SqlOperation nodes are often included in exception messages in Core. SqlOperation properties are pretty jank/confusing, and tend to look like:Sql Operation
sql operation.demo_data.query
from remote system.sql
(there isn't actually a path, but still, this stinks)name
(it's hardcoded asname
!! PR to make it configurable here Fix adapter reset race condition in lib.py dbt-core#5921)Most exceptions in dbt follow the format:
Errors from dbt Core that pertain to Sql Operations (eg. compile queries) tend to look like:
I think that
sql operation name (from remote system.sql)
is possibly the most confusing fragment of an error message that I've ever seen, so trying to change that here 😓 . Note that this PR also removes logic that replaces newlines with spaces. I think having separate lines for these error messages makes them a lot more intelligible (especially if there is a stack trace for macro calls), but I'm open to changing that back if anyone has alternative thoughts or opinions. Practical examples below!Syntax errors
before
After
Ref not found errors
These are better than before, but still not ideal. dbt is trying to tell us that our sql operation node (named
Sql Operation 'sql operation.demo_data.query' (from remote system.sql)
) depends on a node calledbadmodel
Before
After
Macro stack traces
Before
TODO
After
TODO