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

Is the addition of an IAM (particularly authorized view permissions) additive or destructive? #569

Closed
goyalmunish opened this issue Mar 22, 2021 · 5 comments
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. type: question Request for information or clarification. Not an issue.

Comments

@goyalmunish
Copy link

Is the addition of an IAM (particularly authorized view permissions) additive or destructive?

In a process to add an access_entry to a view_dataset, does BQ has to drop existing ones and then create all (along with new addition) of them, or is it smart enough to keep the existing ones untouched? If it is a destructive one, then similar calls (adding different access entries to the same dataset) from two different clients can encounter race conditions.

# additive or destructive?
access_entries.append(some_new_access_entry)
view_dataset.access_entries = access_entries

image

The corresponding API (https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets/patch) (and data object https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets) also doesn't seem to provide any details on this.

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Mar 22, 2021
@goyalmunish
Copy link
Author

@tswast tswast added the type: question Request for information or clarification. Not an issue. label Mar 22, 2021
@tswast
Copy link
Contributor

tswast commented Mar 22, 2021

This replaces the existing ACLs.

As far as race conditions are concerned, the client library uses the etag property to catch this.

headers = {"If-Match": dataset.etag}

This happens automatically if you first fetch a dataset with get_dataset.

@goyalmunish
Copy link
Author

Okay, so this is if one is using multiple Python clients. But in my case, I am expecting a clash between the Python client library and Terraform (via GitHub automation, Atlantis) as well.

This replaces the existing ACLs.

Do you mean, the existing ones (such as "foo" and "bar") will be dropped and recreated?

# get existing access entries
existing_access_entries = view_dataset.access_entries     # ["foo", "bar"]
# append an additional one to it
access_entries.append(some_new_access_entry)               # ["foo", "bar", "baz"]
# update
view_dataset.access_entries = access_entries                     

@tswast
Copy link
Contributor

tswast commented Mar 24, 2021

Do you mean, the existing ones (such as "foo" and "bar") will be dropped and recreated?

I mean that the whole ACLs property is replaced atomically.

@tswast
Copy link
Contributor

tswast commented Mar 24, 2021

Regarding clash between Python and Terraform, I'm not as familiar with the Terraform provider. It's probably worth confirming with them at https://github.com/hashicorp/terraform-provider-google to see what they do with the ACLs property.

emkornfield pushed a commit to emkornfield/python-bigquery that referenced this issue Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

3 participants