dbt-labs / dbt-labs/dbt

[Bug] Trino/Starburst Cannot use grants with roles.

Open
#12,862 3 comments 0 reactions 0 assignees View on GitHub
engine:v1 status:triage type:bug
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

In Trino/Starburst grants do not work. This only works for users and does not work for groups. This produces

grant select on "data_warehouse"."mwh_analytics_dbt_artifacts"."sources" to ""

Trino/Starburst expects something along the lines of grant select on "data_warehouse"."schema"."table" to ROLE|USER ""

```sql
GRANT ( privilege [, ...] | ( ALL PRIVILEGES ) )
ON [ BRANCH branch_name IN ] ( table_name | TABLE table_name | SCHEMA schema_name)
TO ( user | USER user | ROLE role )
[ WITH GRANT OPTION ]
```


```yaml
models:
- name: NAME_OF_YOUR_MODEL
config:
grants:
select: ['reporter', 'bi']
```

Need away to specify roles:

something like this:

```yaml
models:
  +grants:
    select:
      - role: "PUBLIC"
      - user: "abcd"
```

### Expected Behavior

Expect to have an ability to supply role as it's required for trino when granting to a role.

### Steps To Reproduce

In Trino/Starburst grants do not work. This only works for users and does not work for groups. This produces

grant select on "data_warehouse"."mwh_analytics_dbt_artifacts"."sources" to ""

Trino/Starburst expects something along the lines of grant select on "data_warehouse"."schema"."table" to ROLE|USER ""

```sql
GRANT ( privilege [, ...] | ( ALL PRIVILEGES ) )
ON [ BRANCH branch_name IN ] ( table_name | TABLE table_name | SCHEMA schema_name)
TO ( user | USER user | ROLE role )
[ WITH GRANT OPTION ]
```


```yaml
models:
- name: NAME_OF_YOUR_MODEL
config:
grants:
select: ['reporter', 'bi']
```

Need away to specify roles:

something like this:

```yaml
models:
  +grants:
    select:
      - role: "PUBLIC"
      - user: "abcd"
```

### Relevant log output

```shell

```

### Environment

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

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

_No response_

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