-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[CT-3080] [Bug] Improve Error Messages for Grants #8563
Comments
@callum-mcdata, my friend, thanks for raising this! Do you think this could be at least partially relieved if dbt-labs/dbt-redshift#415 is resolved so that dbt-redshift can use groups or roles in grants (in addition to users)? |
❤️ @dbeatty10 . I guess it depends on how groups are handled because groups actually work just fine in grants! You just need to put Example:
I think an ideal world would have the error message identify where the real issue is. If I had seen |
@callum-mcdata After discussing this with @graciegoheen and @jtcohen6, we had the following idea: A more general ideaWhat if the messages for
Trickiest design elementThe trickiest part from the user interface perspective is determining how to handle long multi-line SQL statements:
Potential sweet spotWe could try to hit a sweet spot between utility and simplicity of implementation by truncating to only include the first 5 lines and offer instructions to check the logs like this:
Broader contextThere's three* main cases where we expect errors to be raised when running dbt subcommands and the user may want to inspect the relevant SQL:
* Unit testing will be a 4th case. One more ideaWhat if we introduced a new subfolder within the
To make the file names unique, we could just take a MD5 hash of the SQL contents (which is where those 32-characters in the file name above come from). I opted for a shorter pathname in the example above, but it could also be more verbose like this:
|
Hi @callum-mcdata, thanks for raising this issue! I think raising a Database Error with the perpetrating sql statement is a great idea 🙂 @dbeatty10 Stumbled across this while investigating support for role grants (and perhaps group grants) through configurations and I am wondering if these approaches would interest you at all since it seems both a dbt-redshift bug/feature request? (Also should this be part of dbt-labs/dbt-redshift#415 My understanding of the issue...
Here are my ideas for addressing the problem: they range from mitigation to drastic changes. simplest idea - mitigationThis is the easiest fix to ship out and would require updating dbt documentation to say
Is this enough? If no, would a modification to DatabaseError as @dbeatty10 suggested be helpful in conjunction with this? alternative idea - segment grants into grant_roles, grant_users, grant_groups
This approach would reduce user error, however has many significant, concerning caveats...
I am not inclined towards this approach mainly due to the first two reasons above, but would love to discuss and know your thoughts. happy weekend 🥳 ! |
Is this a new bug in dbt-core?
Current Behavior
Right now,
grants
display as a database error for the model being run. This makes it very difficult to debug if you are unaware of the full grant logic!This may be running in a single transaction but it would be amazing if we could have the error message display that it was from a grant.
Expected Behavior
I would love if we could have something more like this:
Just a simple designation that the error message is stemming from the grant statement.
Steps To Reproduce
In redshift create a group called analyst but not a user called analyst. Run any dbt model with the following configuration.
However this works just fine
Relevant log output
No response
Environment
Which database adapter are you using with dbt?
redshift
Additional Context
Hi 👋 . Not super high priority but just a little bit of pain that took me a few hours to figure out what was going on. Figured I'd flag to y'all
The text was updated successfully, but these errors were encountered: