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 — Adding scope to credentials in Connection constructors. by dhermes · Pull Request #840 · googleapis/google-cloud-python

Conversation

@dhermes

@dhermes dhermes commented Apr 19, 2015

Copy link
Copy Markdown
Contributor

This also obsoletes get_scoped_connection() so it is removed.

FYI @jgeewax thanks for nudging in this direction. It moves the scope adding behavior into the Connection constructors.

Sorry, something went wrong.

Uh oh!

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

All reactions
@dhermes dhermes added api: core auth labels Apr 19, 2015
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Apr 19, 2015
@coveralls

coveralls commented Apr 19, 2015

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 0cb6fc9 on dhermes:create-scoped-help into 286207b on GoogleCloudPlatform:master.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tseaver

tseaver commented Apr 23, 2015

Copy link
Copy Markdown
Contributor

I might be misremembering, but it feels like we've been around a complete circle here.

All reactions

Sorry, something went wrong.

Uh oh!

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

@dhermes

dhermes commented Apr 23, 2015

Copy link
Copy Markdown
Contributor Author

What's the circle? I don't recall the Connection constructors adding scope, but maybe it happened? AFAIK I am the only "resident expert" when it comes to oauth2client.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tseaver

tseaver commented Apr 23, 2015

Copy link
Copy Markdown
Contributor

6ebc65e moved the scope handling from gcloud.datastore._implicit_environ.get_connection and gcloud.storage._implicit_environ.get_connection up to gcloud._helpers.get_scoped_connection
5588987 moved the function from gcloud._helpers to gcloud.connection.
Now we are pushing the scope handling back down into gcloud.datastore.connection and gcloud.storage.connection.

All reactions

Sorry, something went wrong.

Uh oh!

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

@dhermes

dhermes commented Apr 23, 2015

Copy link
Copy Markdown
Contributor Author

The idea behind this commit is not just churn / moving the code.

We want people to be able to get credentials from elsewhere and pass them in to a connection without worrying about adding the scopes.

If we never expect people to construct a Connection themselves, then this PR is totally moot, but we'd still need to add credentials to the get_connection() methods to allow people a BYOC (bring your own credentials).


This was all brought about by @jgeewax pointing out some alternate auth / credentials flows.

All reactions

Sorry, something went wrong.

Uh oh!

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

@dhermes

dhermes commented Apr 27, 2015

Copy link
Copy Markdown
Contributor Author

@tseaver Can we keep moving on this?

All reactions

Sorry, something went wrong.

Uh oh!

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

jgeewax
jgeewax reviewed Apr 29, 2015
View reviewed changes
Comment thread gcloud/connection.py Outdated

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

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

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

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

@jgeewax

jgeewax commented Apr 29, 2015

Copy link
Copy Markdown
Contributor

If I recall correctly, the difference this makes becomes apparent when you look at the case where you want to use some credentials from a specific file to talk to a service.

Old way:

from gcloud.credentials import get_for_service_account_json
from gcloud import pubsub

credentials = get_for_service_account_json('/path/to/key.json')
credentials = credentials.create_scoped(pubsub.SCOPE)  # <-- The thing I don't want to have to type...
connection = pubsub.Connection(credentials=credentials)
pubsub.set_default_connection(connection)
pubsub.Topic('topic_name').create()

(Also note that in gcloud.datastore SCOPE was inside _implicit_environ which made the code much less readable....)

New way

from gcloud.credentials import get_for_service_account_json
from gcloud import pubsub

credentials = get_for_service_account_json('/path/to/key.json')
connection = pubsub.Connection(credentials=credentials)  # Scoping happens here, where we know we need it...
pubsub.set_default_connection(connection)
pubsub.Topic('topic_name').create()

Is there a reason why you'd want to keep the "scope credentials" action separate from the "create connection" action? I can't think of a reason but maybe you guys know more about this... If there isn't then I fully support this change -- seems much more convenient to do this when creating the connection (and expecting the connection to know which scopes are necessary on the credentials you supplied).

All reactions

Sorry, something went wrong.

Uh oh!

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

@dhermes

dhermes commented Apr 29, 2015

Copy link
Copy Markdown
Contributor Author

I also fully support this change FWIW

All reactions

Sorry, something went wrong.

Uh oh!

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

@dhermes

dhermes commented Apr 30, 2015

Copy link
Copy Markdown
Contributor Author

@tseaver PTAL

All reactions

Sorry, something went wrong.

Uh oh!

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

tseaver
tseaver reviewed Apr 30, 2015
View reviewed changes
Comment thread gcloud/connection.py

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

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

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

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

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

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

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

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

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

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

@dhermes
dhermes force-pushed the create-scoped-help branch from 0cb6fc9 to 7cfc884 Compare May 7, 2015 23:29
@dhermes

dhermes commented May 7, 2015

Copy link
Copy Markdown
Contributor Author

Just rebased on top of HEAD in master.

@tseaver Can we resolve the discussion and move forward here?

All reactions

Sorry, something went wrong.

Uh oh!

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

@dhermes dhermes mentioned this pull request May 8, 2015
Adding Connection factories for credentials. #864
Merged
@coveralls

coveralls commented May 8, 2015

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling 7cfc884 on dhermes:create-scoped-help into a9bc7fe on GoogleCloudPlatform:master.

All reactions

Sorry, something went wrong.

Uh oh!

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

@dhermes

dhermes commented May 12, 2015

Copy link
Copy Markdown
Contributor Author

@tseaver Can we wrap this up?

All reactions

Sorry, something went wrong.

Uh oh!

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

tseaver
tseaver reviewed May 14, 2015
View reviewed changes
Comment thread gcloud/pubsub/connection.py

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

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

@tseaver

tseaver commented May 14, 2015

Copy link
Copy Markdown
Contributor

LGTM, module my comments this morning on the SCOPE docstrings.

All reactions

Sorry, something went wrong.

Uh oh!

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

@dhermes
Adding scope to credentials in Connection constructors.
b44b25b
This also obsoletes get_scoped_connection() so it is removed.
@dhermes
dhermes force-pushed the create-scoped-help branch from 7cfc884 to b44b25b Compare May 14, 2015 18:36
@dhermes

dhermes commented May 14, 2015

Copy link
Copy Markdown
Contributor Author

Rebased on top of master (#879 #881 in particular) and added the docstrings into the original PR. Will merge when Travis finishes.

All reactions

Sorry, something went wrong.

Uh oh!

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

dhermes added a commit that referenced this pull request May 14, 2015
@dhermes
Merge pull request #840 from dhermes/create-scoped-help
a888f64
Adding scope to credentials in Connection constructors.
@dhermes
dhermes merged commit a888f64 into googleapis:master May 14, 2015
@dhermes
dhermes deleted the create-scoped-help branch May 14, 2015 18:46
@dhermes dhermes mentioned this pull request Jun 4, 2015
Upgrading version to 0.6.0. #907
Merged
parthea pushed a commit that referenced this pull request Nov 24, 2025
@gcf-owl-bot
chore(python): upgrade gcp-releasetool in .kokoro [autoapprove] (#840)
f4a5e11
Source-Link: googleapis/synthtool@5f2a608
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:8555f0e37e6261408f792bfd6635102d2da5ad73f8f09bcb24f25e6afb5fac97

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Nov 24, 2025
@cindy-peng cindy-peng
chore: create flakybot.yaml to change default issue priority (#840)
2e6c7eb
* chore: create flakybot.yaml to change default issue priority

* add googlel copyright license

---------

Co-authored-by: cindy-peng <[email protected]>
parthea pushed a commit that referenced this pull request Nov 24, 2025
@gcf-owl-bot
build(python): fix docs and docfx builds (#840)
aaf28b1
Source-Link: googleapis/synthtool@fac8444
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5ea6d0ab82c956b50962f91d94e206d3921537ae5fe1549ec5326381d8905cfa

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Nov 24, 2025
@bw-yuhogg
docs(tasklets): Fix Py2-style print statement (#840)
5cc1bab
parthea pushed a commit that referenced this pull request Nov 25, 2025
@gcf-owl-bot
build(python): fix docs and docfx builds (#840)
4688f57
Source-Link: googleapis/synthtool@fac8444
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5ea6d0ab82c956b50962f91d94e206d3921537ae5fe1549ec5326381d8905cfa

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Nov 26, 2025
@busunkim96 @release-please
chore: set release version to 2.0.0 (#840)
1e20b35
* chore: release 2.0.0

* Update CHANGELOG.md

* chore: set version number to 2.0.0

Follow up to #829

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Mar 6, 2026
@tswast @gcf-owl-bot @plamut
feat: add support for INTERVAL data type to list_rows (#840)
60f4cc9
* test: refactor `list_rows` tests and add test for scalars

* WIP: INTERVAL support

* feat: add support for INTERVAL data type to `list_rows`

* fix relativedelta construction for non-microseconds

* WIP: support INTERVAL query params

* remove dead code

* INTERVAL not supported in query parameters

* revert query parameter changes

* add validation error for interval

* add unit tests for extreme intervals

* add dateutil to intersphinx

* use dictionary for intersphinx

* 🦉 Updates from OwlBot

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

* 🦉 Updates from OwlBot

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

* add test case for trailing .

* explicit none

* 🦉 Updates from OwlBot

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

* truncate nanoseconds

* use \d group for digits

* use \d for consistency

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Peter Lamut <[email protected]>
parthea pushed a commit that referenced this pull request Mar 6, 2026
@gcf-owl-bot
chore: rename rst files to avoid conflict with service names (#840)
5760524
Source-Link: googleapis/synthtool@d52e638
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:4f9b3b106ad0beafc2c8a415e3f62c1a0cc23cabea115dbe841b848f581cfe99

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Mar 9, 2026
@renovate-bot
chore(deps): update dependency cachetools to v7 (#840)
0c41418
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| cachetools | `==6.2.6` → `==7.0.2` |
![age](https://developer.mend.io/api/mc/badges/age/pypi/cachetools/7.0.2?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/cachetools/6.2.6/7.0.2?slim=true)
|

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/googleapis/python-spanner-sqlalchemy).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My40OC4xIiwidXBkYXRlZEluVmVyIjoiNDMuNDguMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
parthea pushed a commit that referenced this pull request Mar 9, 2026
@cojenco
feat: enable delete_blobs() to preserve generation (#840)
f055f90
This adds a flag `preserve_generation` to the method `bucket.delete_blobs()`
- allows preserving and propagating blob generations when set to True (default False)
- better ensures backwards compatibility with both `delete_blobs()` and `bucket.delete(force=True)`

Fixes #814
parthea pushed a commit that referenced this pull request Mar 9, 2026
@surbhigarg92 @larkee
feat: Inline Begin transction for RW transactions (#840)
833a703
* feat: Inline Begin transction for RW transactions

* ILB with lock for execute update and batch update

* Added lock for execute sql and read method

* fix: lint fix and testcases

* fix: lint

* fix: Set transction id along with resume token

* fix: lint

* fix: test cases

* fix: few more test case for restart on unavailable

* test: Batch update error test case

* fix: lint

* fix: Code review comments

* fix: test cases + lint

* fix: code review comments

* fix: deprecate transactionpingingpool msg

* fix: review comments

Co-authored-by: larkee <[email protected]>

* fix: Apply suggestions from code review

Co-authored-by: larkee <[email protected]>

* fix: review comments

* fix: review comment Update tests/unit/test_session.py

Co-authored-by: larkee <[email protected]>

Co-authored-by: larkee <[email protected]>
parthea pushed a commit that referenced this pull request Mar 9, 2026
@release-please
chore(main): release 3.26.0 (#870)
c0763e4
🤖 I have created a release *beep* *boop*
---


## [3.26.0](https://togithub.com/googleapis/python-spanner/compare/v3.25.0...v3.26.0) (2022-12-15)


### Features

* Inline Begin transction for RW transactions ([#840](https://togithub.com/googleapis/python-spanner/issues/840)) ([c2456be](https://togithub.com/googleapis/python-spanner/commit/c2456bed513dc4ab8954e5227605fca12e776b63))


### Bug Fixes

* Fix for binding of pinging and bursty pool with database role ([#871](https://togithub.com/googleapis/python-spanner/issues/871)) ([89da17e](https://togithub.com/googleapis/python-spanner/commit/89da17efccdf4f686f73f87f997128a96c614839))

---
This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

api: core auth cla: yes This human has signed the Contributor License Agreement.

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.

5 participants

@dhermes @coveralls @tseaver @jgeewax @googlebot
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.