dbt-labs / dbt-labs/dbt

[CT-3080] [Bug] Improve Error Messages for Grants

Open
#8,563 5 comments 1 reaction 1 assignee Claimed by @dbeatty10 View on GitHub
engine:v1 grants paper_cut type:feature
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

### Is this a new bug in dbt-core?

- [X] I believe this is a new bug in dbt-core
- [X] I have searched the existing issues, and I could not find an existing issue for this bug

### 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!

```
14:09:27 Database Error in model model_name (models/folder/folder/folder/model_name.sql)
14:09:27 user "analyst" does not exist
```

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:

```
14:09:27 Database Error in model model_name (models/folder/folder/folder/model_name.sql)
14:09:27 GRANT: user "analyst" does not exist
```

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.
```
models:
+grants:
select: ["analyst"]
```

However this works just fine

```
models:
+grants:
select: ["group analyst"]
```

### Relevant log output

_No response_

### Environment

```markdown
- OS:MacOS
- Python: 3.11
- dbt: 1.6.1
```

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.