GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — docs: add sample for revoking dataset access by loferris · Pull Request #778 · googleapis/python-bigquery

This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Conversation

@loferris

@loferris loferris commented Jul 16, 2021

Copy link
Copy Markdown
Contributor

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • [x ] Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • [x ] Ensure the tests and linter pass
  • [x ] Code coverage does not decrease (if any source code was changed)
  • [x ] Appropriate docs were updated (if necessary)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Lo Ferris added 4 commits July 1, 2021 16:50
Lo Ferris
revoke dataset access setup
0abac4c
Lo Ferris
basic template for sample
d699bec
Lo Ferris
sample + test
98b245d
Lo Ferris
revoke dataset access sample
f1adee7
@loferris
loferris requested a review from a team as a code owner July 16, 2021 22:44
@loferris
loferris requested review from crwilcox and removed request for a team July 16, 2021 22:44
@snippet-bot

snippet-bot Bot commented Jul 16, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 4 region tags.
  • samples/snippets/revoke_dataset_access.py:20, tag bigquery_revoke_dataset_access
  • samples/snippets/revoke_dataset_access.py:30, tag bigquery_revoke_dataset_access
  • samples/snippets/update_dataset_access.py:20, tag bigquery_update_dataset_access
  • samples/snippets/update_dataset_access.py:49, tag bigquery_update_dataset_access

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@product-auto-label product-auto-label Bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Jul 16, 2021
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 16, 2021
@gcf-owl-bot
🦉 Updates from OwlBot
e729bbd
See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md
plamut
plamut reviewed Jul 19, 2021
View reviewed changes

@plamut plamut left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Found a few things that could probably be improved, although nothing really major.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread samples/revoke_dataset_access.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread samples/revoke_dataset_access.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread samples/revoke_dataset_access.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@plamut plamut added the samples Issues that are directly related to samples. label Jul 19, 2021
@plamut plamut changed the title feat bigquery remove view access docs: add sample for revoking dataset access Jul 19, 2021
tswast
tswast suggested changes Jul 19, 2021
View reviewed changes
Comment thread samples/revoke_dataset_access.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread samples/revoke_dataset_access.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread samples/revoke_dataset_access.py Outdated
client = bigquery.Client()

# TODO(developer): Set dataset_id to the ID of the dataset to fetch.
# dataset_id = 'your-project.your_dataset'

@tswast tswast Jul 19, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I've gotten docs feedback from users skip over this comments and get confused. Could we instead follow this pattern where we set a real value and then immediately unset it?

https://github.com/googleapis/python-bigquery-storage/blob/fb3d0bb7b195c33f8ae602d9e22f612048581891/samples/to_dataframe/read_table_bqstorage.py#L17-L21

I didn't add the TODO comment in that BQ Storage sample, but I do like that you have it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@loferris loferris Jul 23, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread samples/revoke_dataset_access.py Outdated
entries = list(dataset.access_entries)

for entry in entries:
if entry.entity_id == entity_id:

@tswast tswast Jul 19, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

You use entity_id without showing an example value. Each code sample should be as copy-pasteable as possible. Add the setter for this by the setter for dataset_id.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@loferris loferris Jul 23, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread samples/revoke_dataset_access.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread samples/revoke_dataset_access.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Lo Ferris added 3 commits July 23, 2021 14:39
Lo Ferris
docs: add sample for revoking dataset access - update year and string…
b80c4bf
… formatting
Lo Ferris
Merge branch 'bigquery_remove_view_access' of github.com:googleapis/p…
2960b48
…ython-bigquery into bigquery_remove_view_access

merging in changes from remote branch
Lo Ferris
docs: add sample for revoking dataset access - move to snippets and c…
02bd2b4
…hange parameter pattern for readibility
@loferris

loferris commented Jul 23, 2021

Copy link
Copy Markdown
Contributor Author

@tswast @plamut
I've updated the PR with commits addressing the above comments!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

plamut
plamut approved these changes Jul 26, 2021
View reviewed changes

@plamut plamut left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Looks good, thanks for making the changes.

I'll let Tim comment on START/END section naming (in case there are some implicit conventions), although the changes look consistent with the linked pattern to me.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@plamut plamut added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 26, 2021
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 26, 2021
plamut
plamut previously requested changes Jul 26, 2021
View reviewed changes

@plamut plamut left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Whoops, it appears we need to add __init__.py to samples/snippets, it's currently not present:

/usr/local/lib/python3.6/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
revoke_dataset_access_test.py:15: in <module>
    from .. import update_dataset_access
E   ImportError: attempted relative import with no known parent package

We'll also need to adjust the imports in the test, because both files are now in the same directory. The following will fail now:

from .. import revoke_dataset_access

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tswast

tswast commented Jul 26, 2021

Copy link
Copy Markdown
Contributor

Whoops, it appears we need to add init.py to samples/snippets, it's currently not present:

If we do add it, then we'll need to change all the other tests to in sample/snippets to use relative imports as well.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@plamut

plamut commented Jul 26, 2021

Copy link
Copy Markdown
Contributor

Whoops, it appears we need to add init.py to samples/snippets, it's currently not present:

If we do add it, then we'll need to change all the other tests to in sample/snippets to use relative imports as well.

Indeed. It's a bit more (one-time) work, but it will make the snippets/ subpackage consistent with geography/.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tswast
tswast suggested changes Jul 26, 2021
View reviewed changes
Comment thread samples/snippets/revoke_dataset_access_test.py Outdated
# See the License for the specific language governing permissions and
# limitations under the License.

from .. import update_dataset_access

@tswast tswast Jul 26, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

As mentioned in the comment, adding samples/snippets/__init__.py should fix this, but it'll break the other sample tests. You'll need to also update the tests in samples/snippets/ to use relative imports.

Alternatively, we can start making progress on migrating the snippets to samples/snippets (#790). You could make a copy of update_dataset_access.py and it's corresponding tests and put them in the samples/snippets directory in this PR. Then once you've pointed cloud.google.com at the new sample location, send a PR to remove the duplicate sample.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@loferris loferris Jul 26, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I like the latter approach!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@loferris loferris Jul 27, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

done in latest commit!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread samples/snippets/revoke_dataset_access_test.py Outdated
# limitations under the License.

from .. import update_dataset_access
from .. import revoke_dataset_access

@tswast tswast Jul 26, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This should be from . import revoke_dataset_access since it's the same directory as the test. (Also will need __init__.py for that to work.) If you go with the "copy" alternative (without __init__.py), then this should be import revoke_dataset_access.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread samples/snippets/revoke_dataset_access_test.py Outdated
revoke_dataset_access.revoke_dataset_access(dataset_id, entity_id)

out, err = capsys.readouterr()
assert f"Updated dataset '{dataset_id}' with modified user permissions." in out

@tswast tswast Jul 26, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Could you look for a message specific to "revoke"? I worry that this could catch the original update and the revoke could be failing.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@tswast tswast Jul 26, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Also, let's add some additional steps to call get_dataset and check that the dataset access was actually updated.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@loferris loferris Jul 27, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

would you recommend the pytest fixture pattern to create a bigquery client that I can call this on? I'm seeing it in some other snippets but not the update_access sample. I also need to move get_dataset to /snippets as well!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread samples/snippets/revoke_dataset_access.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread samples/snippets/revoke_dataset_access.py Outdated
entries = list(dataset.access_entries)

for entry in entries:
if entry.entity_id == entity_id:

@tswast tswast Jul 26, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Do you think we should we look at entity_type, too? Maybe not? I suppose there shouldn't be much conflict between whether an email address is associated with a group, service account, or user.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with eyes emoji
All reactions
  • 👀 1 reaction

@loferris loferris Jul 27, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

once I get the tests updated I'll play around with it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread samples/snippets/revoke_dataset_access.py Outdated
dataset = client.update_dataset(dataset, ["access_entries"]) # Make an API request.

full_dataset_id = f"{dataset.project}.{dataset.dataset_id}"
print(f"Updated dataset '{full_dataset_id}' with modified user permissions.")

@tswast tswast Jul 26, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Including the word "revoked" and possibly the entity ID here could give us a better idea that this actually worked.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread samples/snippets/revoke_dataset_access.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

tswast
tswast reviewed Jul 26, 2021
View reviewed changes
Comment thread samples/snippets/revoke_dataset_access.py Outdated

for entry in entries:
if entry.entity_id == entity_id:
entry.role = None

@tswast tswast Jul 26, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'm curious to see if this works as expected. The alternative is to remove the whole entry from the list.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@loferris loferris Jul 27, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'm going to remove it...

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Lo Ferris and others added 3 commits July 27, 2021 13:45
Lo Ferris
moving update_dataset to /snippets and adjusting imports on both revo…
fa0e48c
…ke_access and update_access
@loferris @tswast
Update samples/snippets/revoke_dataset_access.py
98bb4a2
removed nested START/END tags

Co-authored-by: Tim Swast <[email protected]>
@loferris @tswast
Update samples/snippets/revoke_dataset_access.py
8c4bc7a
update readability in API request

Co-authored-by: Tim Swast <[email protected]>
Lo Ferris added 2 commits November 19, 2021 16:14
Lo Ferris
updating test
adc1c76
Lo Ferris
refactored sample
62ec25e
@loferris

loferris commented Nov 22, 2021

Copy link
Copy Markdown
Contributor Author

Hi @tswast This is ready for a final/next review!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tswast
tswast self-requested a review November 23, 2021 16:32
@tswast
Update samples/snippets/conftest.py
072b785
tswast
tswast suggested changes Nov 23, 2021
View reviewed changes
Comment thread samples/snippets/revoke_dataset_access.py Outdated
)

entries = list(dataset.access_entries)
entries.append(entry)

@tswast tswast Nov 23, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'm a bit confused as to why we'd add the entry and then remove it on line 42. Perhaps a copy-paste error?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@loferris loferris Nov 23, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I think it's a redundancy - I was adding a specific entry to alter but I think that'll be covered in the test case and sort of muddies the water in the sample itself. I'll refactor.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread samples/snippets/revoke_dataset_access.py Outdated
entry = bigquery.AccessEntry(
role="READER",
entity_type="groupByEmail",
entity_id="[email protected]",

@tswast tswast Nov 23, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Should this be entity_id=entity_id?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@loferris loferris Nov 23, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Makes sense to me!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread samples/snippets/revoke_dataset_access.py Outdated

entry = bigquery.AccessEntry(
role="READER",
entity_type="groupByEmail",

@tswast tswast Nov 23, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

We should add a comment saying that the developer will need to set this to the correct type.

Although, perhaps we can delete this whole line 32-36? A code sample should only contain the logic necessary for the developer to understand the concept we're trying to teach them.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@loferris loferris Nov 24, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I took it out!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread samples/snippets/revoke_dataset_access.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread samples/snippets/revoke_dataset_access.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread samples/snippets/update_dataset_access.py Outdated
entry = bigquery.AccessEntry(
role="READER",
entity_type="groupByEmail",
entity_id="[email protected]",

@tswast tswast Nov 23, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Do we want to use the entity_id fixture here? If so, we should add a variable above.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@loferris loferris Nov 24, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Added, changed test as well!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread samples/snippets/update_dataset_access.py Outdated

entry = bigquery.AccessEntry(
role="READER",
entity_type="groupByEmail",

@tswast tswast Nov 23, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This needs a comment explaining the various options available, or at least a link to the docs where these are described.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@loferris loferris Nov 24, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Added!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread samples/snippets/update_dataset_access.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread samples/snippets/dataset_access_permissions_test.py
@@ -0,0 +1,49 @@
# Copyright 2021 Google LLC

@tswast tswast Nov 23, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Nit: In the filename, "access" and "permissions" are redundant. Let's call it dataset_access_test.py.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@loferris loferris Nov 24, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Done in latest commit!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread samples/snippets/README.rst Outdated
https://cloud.google.com/python/setup

#. Create a virtualenv. Samples are compatible with Python 3.6+.
#. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.

@tswast tswast Nov 23, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@loferris Please revert the changes to this file.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loferris reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
loferris and others added 6 commits November 23, 2021 09:49
@loferris @tswast
Update samples/snippets/revoke_dataset_access.py
dade3b8
Co-authored-by: Tim Swast <[email protected]>
@loferris @tswast
Update samples/snippets/update_dataset_access.py
c74022e
Co-authored-by: Tim Swast <[email protected]>
@loferris @tswast
Update samples/snippets/revoke_dataset_access.py
9da6de6
Co-authored-by: Tim Swast <[email protected]>
@loferris @tswast
Update samples/snippets/revoke_dataset_access.py
ede9158
Co-authored-by: Tim Swast <[email protected]>
Lo Ferris
refactoring entry
05a4f19
Lo Ferris
added comment for entry access
6c04f28
@loferris

loferris commented Nov 24, 2021

Copy link
Copy Markdown
Contributor Author

All comments addressed! @tswast

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@loferris loferris self-assigned this Nov 24, 2021
@tswast
tswast self-requested a review November 29, 2021 17:02
@tswast
Merge branch 'main' into bigquery_remove_view_access
d030e21
tswast
tswast suggested changes Nov 29, 2021
View reviewed changes
Comment thread samples/snippets/README.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread samples/snippets/dataset_access_test.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread samples/snippets/dataset_access_test.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread samples/snippets/update_dataset_access.py Outdated
client = bigquery.Client()

# TODO(developer): Set dataset_id to the ID of the dataset to fetch.
# dataset_id = 'your-project.your_dataset'

@tswast tswast Nov 29, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Looks like we missed this one.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
loferris and others added 4 commits November 29, 2021 11:34
@loferris @tswast
Update samples/snippets/README.rst
023eb96
Co-authored-by: Tim Swast <[email protected]>
@loferris @tswast
Update samples/snippets/dataset_access_test.py
6d9f274
Co-authored-by: Tim Swast <[email protected]>
@loferris @tswast
Update samples/snippets/dataset_access_test.py
3fd6856
Co-authored-by: Tim Swast <[email protected]>
Lo Ferris
added develper TODO in sample
6ce391d
@loferris
loferris requested a review from tswast November 29, 2021 19:49
@tswast
add comments to samples
04497a1
tswast
tswast approved these changes Dec 6, 2021
View reviewed changes

@tswast tswast left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM. I've pushed some minor updates to the comments.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread samples/snippets/revoke_dataset_access.py Outdated
dataset = client.get_dataset(dataset_id) # Make an API request.

entries = list(dataset.access_entries)
dataset.access_entries = entries

@tswast tswast Dec 6, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This line confuses me. It gets overwritten in the next line of code, so looks unnecessary. Possibly leftover from a debugging?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tswast
Merge branch 'main' into bigquery_remove_view_access
2e98eca
@tswast
tswast requested a review from plamut December 6, 2021 16:52
@tswast
tswast dismissed plamut’s stale review December 6, 2021 17:39

stale

@tswast
tswast merged commit effd673 into main Dec 6, 2021
@tswast
tswast deleted the bigquery_remove_view_access branch December 6, 2021 17:50
abdelmegahedgoogle pushed a commit to abdelmegahedgoogle/python-bigquery that referenced this pull request Apr 17, 2023
@loferris @gcf-owl-bot
@tswast @plamut @parthea @meredithslota @abdelmegahedgoogle
docs: add sample for revoking dataset access (googleapis#778)
7adb528
* revoke dataset access setup

* basic template for sample

* sample + test

* revoke dataset access sample

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md

* docs: add sample for revoking dataset access - update year and string formatting

* docs: add sample for revoking dataset access - move to snippets and change parameter pattern for readibility

* moving update_dataset to /snippets and adjusting imports on both revoke_access and update_access

* Update samples/snippets/revoke_dataset_access.py

removed nested START/END tags

Co-authored-by: Tim Swast <[email protected]>

* Update samples/snippets/revoke_dataset_access.py

update readability in API request

Co-authored-by: Tim Swast <[email protected]>

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md

* updated test

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md

* change after running test

* resolving linting failure, rewriting test

* removed relative import errors

* remove relative mport from update_dataset_access

* adding fixture to conftest.py

* updated sample

* updating sample to match new update_access sample

* fixing region tags

* consolidated tests into one file for both methods

* updating test to full_dataset format

* updated revoke sample

* updating test

* refactored sample

* Update samples/snippets/conftest.py

* Update samples/snippets/revoke_dataset_access.py

Co-authored-by: Tim Swast <[email protected]>

* Update samples/snippets/update_dataset_access.py

Co-authored-by: Tim Swast <[email protected]>

* Update samples/snippets/revoke_dataset_access.py

Co-authored-by: Tim Swast <[email protected]>

* Update samples/snippets/revoke_dataset_access.py

Co-authored-by: Tim Swast <[email protected]>

* refactoring entry

* added comment for entry access

* Update samples/snippets/README.rst

Co-authored-by: Tim Swast <[email protected]>

* Update samples/snippets/dataset_access_test.py

Co-authored-by: Tim Swast <[email protected]>

* Update samples/snippets/dataset_access_test.py

Co-authored-by: Tim Swast <[email protected]>

* added develper TODO in sample

* add comments to samples

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Tim Swast <[email protected]>
Co-authored-by: Peter Lamut <[email protected]>
Co-authored-by: Anthonios Partheniou <[email protected]>
Co-authored-by: meredithslota <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@shollyman shollyman Awaiting requested review from shollyman
@plamut plamut Awaiting requested review from plamut
3 more reviewers
@crwilcox crwilcox crwilcox left review comments
@parthea parthea parthea left review comments
@tswast tswast tswast approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@loferris loferris

Labels

api: bigquery Issues related to the googleapis/python-bigquery API. cla: yes This human has signed the Contributor License Agreement. samples Issues that are directly related to samples.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@loferris @tswast @plamut @crwilcox @parthea @yoshi-kokoro @meredithslota
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.