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

Better error messaging for malformed source/ref inputs #1660

Closed
ryantuck opened this issue Aug 5, 2019 · 3 comments · Fixed by #1809
Closed

Better error messaging for malformed source/ref inputs #1660

ryantuck opened this issue Aug 5, 2019 · 3 comments · Fixed by #1809
Labels
enhancement New feature or request good_first_issue Straightforward + self-contained changes, good for new contributors!

Comments

@ryantuck
Copy link

ryantuck commented Aug 5, 2019

Feature

Catch malformed inputs to source() and ref() functions and elegantly bubble up to end user.

Current error messaging is non-obvious

had a colleague who is new to dbt encounter the following cryptic error today:

__call__() missing 1 required positional argument: ‘table_name’

my hunch, knowing a good amount about dbt, was that this was related to a malformed source() call, was correct, as he only passed one arg into that fn instead of two:

{{ source('some_table') }}
vs
{{ source('my_schema', 'some_table') }}

even with the --debug flag, this was difficult to track down

Request

It seems like these sorts of errors could be caught and communicated more effectively (I can't imagine my colleague is the first or last one to make this mistake), to output something like:

ERROR: source() function requires two arguments, but received only one
    in models/my_model/some_table.sql (line 51)
    >>>   from {{ source('my_table') }}

Who will this benefit?

This will benefit any user who mistakenly leaves out a schema designation in her source() usage, or mistakenly includes a schema designation in a ref() call.

@drewbanin drewbanin added the enhancement New feature or request label Aug 5, 2019
@drewbanin
Copy link
Contributor

Thanks @ryantuck - great idea, and should be straightforward to implement. Is this something you're interested in contributing a fix for?

@drewbanin drewbanin added the good_first_issue Straightforward + self-contained changes, good for new contributors! label Aug 5, 2019
@ryantuck
Copy link
Author

ryantuck commented Aug 7, 2019

@drewbanin I'll see how much time I have on a night or a weekend coming up to see what I can do :)

@abronner
Copy link

abronner commented Sep 9, 2019

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good_first_issue Straightforward + self-contained changes, good for new contributors!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants