dbt-labs / dbt-labs/dbt-adapters

[Bug] GRANT revoke statements in redshift fails when usernames contain certain characters (eg. `.`)

Open
#172 5 comments 0 reactions 0 assignees View on GitHub
feature:grants feature:quoting type:enhancement
Dominant language
Python
Stars
233
Forks
362
Avg merge
3d 22h
Merged PRs (30d)
9

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

When grants are setup in an incremental model dbt attempts to run some a REVOKE statement. When the username(s) that currently have access to that table contain a dot character (eg. `ivan.sabik`), which is completely valid for a Redshift username , building those models fails with:

```
syntax error at or near "."
```

That would be solved by adding quotes to those users, that is instead of `revoke select on table eventview from ivan.sabik` it should be `revoke select on table eventview from "ivan.sabik"`

### Expected Behavior

REVOKE statements don't throw a syntax error

### Steps To Reproduce

1. Create a username containing a dot character
2. Run an incremental dbt model
3. Manually add GRANT statements for the user from step 1
4. Add a grant configuration in dbt for this model
5. Re-run the model
6. Confirm you get an error: `syntax error at or near "."`

### Relevant log output

_No response_

### Environment

```markdown
- OS:
- Python:
- dbt:
```

### Which database adapter are you using with dbt?

redshift

### Additional Context

_No response_

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.