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

Add Grants to BigQuery Materializations #212

Merged
merged 31 commits into from
Jul 11, 2022
Merged

Conversation

emmyoop
Copy link
Member

@emmyoop emmyoop commented Jun 29, 2022

resolves #198

Before merge

  • Reinstate original version of dev-requirements.txt
  • Ensure merging into main rather than a custom branch

Description

This is dependent on dbt-labs/dbt-core#5263

location is required for the sql only approach but logic needs to be added around defaulting the location. Currently the working state has the location hard coded.

Checklist

  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt-bigquery next" section.

@cla-bot cla-bot bot added the cla:yes label Jun 29, 2022
Copy link
Contributor

@jtcohen6 jtcohen6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pushing up the draft PR !!

This also serves as a nice outline of what most adapters will need to implement to make use of the grants feature

dbt/include/bigquery/macros/materializations/copy.sql Outdated Show resolved Hide resolved
dbt/include/bigquery/macros/adapters/apply_grants.sql Outdated Show resolved Hide resolved
dbt/include/bigquery/macros/adapters/apply_grants.sql Outdated Show resolved Hide resolved
dbt/adapters/bigquery/impl.py Outdated Show resolved Hide resolved
dbt/include/bigquery/macros/adapters/apply_grants.sql Outdated Show resolved Hide resolved
dbt/include/bigquery/macros/adapters/apply_grants.sql Outdated Show resolved Hide resolved
dbt/include/bigquery/macros/materializations/table.sql Outdated Show resolved Hide resolved
dev-requirements.txt Outdated Show resolved Hide resolved
@emmyoop emmyoop changed the title Er/ct 717 grant materialization Add Grants to BigQuery Materializations Jul 7, 2022
dev-requirements.txt Outdated Show resolved Hide resolved
Copy link
Member Author

@emmyoop emmyoop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0/5 tests pass right now. The immediate root cause seems to be the replace logic for the privileges. I've worked through some of it but there seems to be more.

There may also be a bug in the grant/revoke logic as the version of test_model_grants in this repo fails on an assertion error of grants matching.

dbt/include/bigquery/macros/adapters/apply_grants.sql Outdated Show resolved Hide resolved
test.env.example Outdated Show resolved Hide resolved
tests/conftest.py Outdated Show resolved Hide resolved
tests/functional/adapter/test_grants.py Outdated Show resolved Hide resolved
tests/functional/adapter/test_model_grants_local.py Outdated Show resolved Hide resolved
@jtcohen6 jtcohen6 changed the base branch from main to dbeatty/grantee-env-vars-take-2 July 11, 2022 07:40
@jtcohen6 jtcohen6 marked this pull request as ready for review July 11, 2022 10:30
@dbeatty10 dbeatty10 self-requested a review July 11, 2022 14:20
Copy link
Contributor

@dbeatty10 dbeatty10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Looks good to me. Awesome collaboration @emmyoop and @jtcohen6 to figure out all the tricky corner cases and solve them. 🙌

Base automatically changed from dbeatty/grantee-env-vars-take-2 to main July 11, 2022 16:38
jtcohen6 and others added 5 commits July 11, 2022 11:46
* Alt approach to grabbing + factoring info_schema region

* add exception for blank location

* Update dbt/adapters/bigquery/relation.py

Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>

* point to existing branch

* fix pre commit errors

Co-authored-by: Emily Rockman <emily.rockman@dbtlabs.com>
Co-authored-by: Doug Beatty <44704949+dbeatty10@users.noreply.github.com>
@McKnight-42 McKnight-42 self-requested a review July 11, 2022 18:46
Copy link
Contributor

@McKnight-42 McKnight-42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome curious if the location thing was the issue we were hitting last week?

@emmyoop emmyoop merged commit 942d460 into main Jul 11, 2022
@emmyoop emmyoop deleted the er/ct-717-grant-materialization branch July 11, 2022 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-717] Add Grants to BigQuery Materializations
5 participants