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 — Ensure bucket upload methods return the blob. by tseaver · Pull Request #597 · googleapis/google-cloud-python

Conversation

@tseaver

@tseaver tseaver commented Feb 6, 2015

Copy link
Copy Markdown
Contributor

Fixes #596.

Sorry, something went wrong.

Uh oh!

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

All reactions
@tseaver
Ensure blob/bucket upload methods return the blob.
d3bc612
Fixes #596.
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 6, 2015
@coveralls

coveralls commented Feb 6, 2015

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling d3bc612 on tseaver:596-return_blob_from_bucket_upload_file_obj into 9518db7 on GoogleCloudPlatform:master.

All reactions

Sorry, something went wrong.

Uh oh!

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

@dhermes

dhermes commented Feb 6, 2015

Copy link
Copy Markdown
Contributor

@tseaver WDYT of having Blob.upload_* methods return nothing (Blob already around) and having the Bucket.upload_ methods return the new objects?


As an aside (outside of this PR), I feel like having a single upload() and a single download() method could be feasible / easy to use? This requires type / interface checking for the objects passed in.

We have (happily, for me) moved away from multi-type behavior for inputs, e.g. datastore.put(entity) fails and only a list is accepted, e.g. datastore.put([entity]).

Somehow I feel like this is slightly different since there is only one action (download) but 3 legitimate places to download to

  • bytes object (return value)
  • writable buffer (e.g. BytesIO or something attached to something other than the FS)
  • buffer pointed to the filesystem

As another aside (outside of this PR), shall we cut a release tomorrow?

All reactions

Sorry, something went wrong.

Uh oh!

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

@tseaver
Suppress 'return self' from 'Blob.upload_*'.
dceabc6
@coveralls

coveralls commented Feb 6, 2015

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 100.0% when pulling dceabc6 on tseaver:596-return_blob_from_bucket_upload_file_obj into 9518db7 on GoogleCloudPlatform:master.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tseaver

tseaver commented Feb 6, 2015

Copy link
Copy Markdown
Contributor Author

dceabc6 drops the return self from the Blob.update_* methods.


I'm not sure that a single upload / download would be easier to use in practice, unless we just made the user pass / receive a file-like object everywhere. E.g.:

    def upload(self, name, file_obj):
        """Upload a blob into this bucket.

        :type name: string
        :param name: name of the blob within the bucket.

        :type file_obj: readable file-like object
        :param blob: an object that can be read like a file.

        :rtype: :class:`Blob`
        :returns: The created / updated Blob object.
        """

    def download(self, name, file_obj):
        """Download a blob from this bucket

        :type name: string
        :param name: name of the blob within the bucket.

        :type file_obj: writeable file-like object
        :param blob: an object that can be written like a file.
        """

A release today seems like a good plan. Is it just a matter of making a tag, or does somebody need to to PyPI stuff manually?

All reactions

Sorry, something went wrong.

Uh oh!

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

@tseaver tseaver changed the title Ensure blob/bucket upload methods return the blob. Ensure bucket upload methods return the blob. Feb 6, 2015
@dhermes

dhermes commented Feb 6, 2015

Copy link
Copy Markdown
Contributor

LGTM.


Yeah I think the single-use upload() / download() may be tricky to do right, but still want to give it a try. I was more curious if you thought it was too inconsistent to "forbid" multi-type signatures in one place and to actively seek them out here.


I will prepare the tag today. Our Travis config deals with PyPI for us, so no issues there. The only effort is put release notes in the tag (which will be copious here).

All reactions

Sorry, something went wrong.

Uh oh!

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

tseaver added a commit that referenced this pull request Feb 6, 2015
@tseaver
Merge pull request #597 from tseaver/596-return_blob_from_bucket_uplo…
edaa5c8
…ad_file_obj

Ensure bucket upload methods return the blob.
@tseaver
tseaver merged commit edaa5c8 into googleapis:master Feb 6, 2015
@tseaver
tseaver deleted the 596-return_blob_from_bucket_upload_file_obj branch February 6, 2015 18:43
vchudnov-g pushed a commit that referenced this pull request Sep 20, 2023
@gcf-owl-bot
chore(python): drop flake8-import-order in samples noxfile (#597)
303ae04
Source-Link: googleapis/synthtool@6ed3a83
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3abfa0f1886adaf0b83f07cb117b24a639ea1cb9cffe56d43280b977033563eb

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Aug 21, 2025
@release-please
chore(main): release 2.20.0 (#597)
ba3acc1
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Sep 16, 2025
@release-please @parthea
chore(main): release 2.20.0 (#597)
6760b3d
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Sep 18, 2025
@chalmerlowe @gcf-owl-bot
chore: updates python version to 3.11 (#597)
51bd0c4
* chore: updates python version to 3.11

* 🦉 Updates from OwlBot post-processor

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

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Nov 22, 2025
@release-please
chore(main): release 2.10.1 (#597)
229b492
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Nov 24, 2025
@tseaver
fix: ignore types for imports generated from 'google.api_core' (#597)
f3fe615
Closes #596.
parthea pushed a commit that referenced this pull request Nov 24, 2025
@release-please
chore(main): release 2.16.2 (#597)
2187176
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea added a commit that referenced this pull request Nov 24, 2025
@parthea
chore: remove unused files (#597)
2ada500
parthea pushed a commit that referenced this pull request Nov 24, 2025
@dandhlee @meredithslota
docs: fix changelog header to consistent size (#597)
fe6ace2
Co-authored-by: meredithslota <[email protected]>
parthea pushed a commit that referenced this pull request Nov 24, 2025
@JustinBeckwith
build: migrate to flakybot (#597)
541698a
parthea pushed a commit that referenced this pull request Nov 26, 2025
@arithmetic1728
fix: dummy commit to trigger a auto release (#597)
14545ca
parthea pushed a commit that referenced this pull request Mar 2, 2026
@gcf-owl-bot
chore(deps): update actions/checkout action to v3 (#597)
f8b2c11
Source-Link: googleapis/synthtool@ca87909
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:6162c384d685c5fe22521d3f37f6fc732bf99a085f6d47b677dbcae97fc21392
parthea pushed a commit that referenced this pull request Mar 6, 2026
@jimfulton
feat: accept DatasetListItem where DatasetReference is accepted (#597)
7bfb5af
* split out and pytestify list_tables tests.

Also, exercise dataset polymorphism in some of the tests.

* list_tables now accepts DatasetListItem objects

* Get coverage to 100%

But why do we run coverage on test code?

* lint

* Update exception text for DatasetListItem

* Bypass opentelemetry tracing in unit tests.

* Got rid of opentelemetry tracing checks. They aren't needed.

* abstracted dataset-argument handling

And applied it to `list_tables` and `list_models`.

* Converted list_model tests to pytest and included check for dataset polymorphism

* removed unneeded blanl lines.

* Made list_routines accept DatasetListItem

and conveted list_routines tests to pytest.

* create_dataset accepts DatasetListItem

Also converted create_dataset tests to pytest.

(And fixed some long lines.)

* Converted list_routine tests to pytest

* include string dataset representation in dataset polymorphism.

* removed some unused imports

* Updated delete_dataset tests

- Polymorphoc on dataset
- pytest

* black

* lint

* We don't actually need to avoid opentelemetry

And a 3.6 test dependened on it.

* fixed docstrings to include DatasetListItem in dataset polymorphic APIs.
parthea pushed a commit that referenced this pull request Mar 6, 2026
@release-please
chore: release 2.14.0 (#602)
74972cd
🤖 I have created a release \*beep\* \*boop\*
---
## [2.14.0](https://www.github.com/googleapis/python-bigquery/compare/v2.13.1...v2.14.0) (2021-04-26)


### Features

* accept DatasetListItem where DatasetReference is accepted ([#597](https://www.github.com/googleapis/python-bigquery/issues/597)) ([c8b5581](https://www.github.com/googleapis/python-bigquery/commit/c8b5581ea3c94005d69755c4a3b5a0d8900f3fe2))
* accept job object as argument to `get_job` and `cancel_job` ([#617](https://www.github.com/googleapis/python-bigquery/issues/617)) ([f75dcdf](https://www.github.com/googleapis/python-bigquery/commit/f75dcdf3943b87daba60011c9a3b42e34ff81910))
* add `Client.delete_job_metadata` method to remove job metadata ([#610](https://www.github.com/googleapis/python-bigquery/issues/610)) ([0abb566](https://www.github.com/googleapis/python-bigquery/commit/0abb56669c097c59fbffce007c702e7a55f2d9c1))
* add `max_queue_size` argument to `RowIterator.to_dataframe_iterable` ([#575](https://www.github.com/googleapis/python-bigquery/issues/575)) ([f95f415](https://www.github.com/googleapis/python-bigquery/commit/f95f415d3441b3928f6cc705cb8a75603d790fd6))
* add type hints for public methods ([#613](https://www.github.com/googleapis/python-bigquery/issues/613)) ([f8d4aaa](https://www.github.com/googleapis/python-bigquery/commit/f8d4aaa335a0eef915e73596fc9b43b11d11be9f))
* DB API cursors are now iterable ([#618](https://www.github.com/googleapis/python-bigquery/issues/618)) ([e0b373d](https://www.github.com/googleapis/python-bigquery/commit/e0b373d0e721a70656ed8faceb7f5c70f642d144))
* retry google.auth TransportError by default ([#624](https://www.github.com/googleapis/python-bigquery/issues/624)) ([34ecc3f](https://www.github.com/googleapis/python-bigquery/commit/34ecc3f1ca0ff073330c0c605673d89b43af7ed9))
* use pyarrow stream compression, if available ([#593](https://www.github.com/googleapis/python-bigquery/issues/593)) ([dde9dc5](https://www.github.com/googleapis/python-bigquery/commit/dde9dc5114c2311fb76fafc5b222fff561e8abf1))


### Bug Fixes

* consistent percents handling in DB API query ([#619](https://www.github.com/googleapis/python-bigquery/issues/619)) ([6502a60](https://www.github.com/googleapis/python-bigquery/commit/6502a602337ae562652a20b20270949f2c9d5073))
* missing license headers in new test files ([#604](https://www.github.com/googleapis/python-bigquery/issues/604)) ([df48cc5](https://www.github.com/googleapis/python-bigquery/commit/df48cc5a0be99ad39d5835652d1b7422209afc5d))
* unsetting clustering fileds on Table is now possible ([#622](https://www.github.com/googleapis/python-bigquery/issues/622)) ([33a871f](https://www.github.com/googleapis/python-bigquery/commit/33a871f06329f9bf5a6a92fab9ead65bf2bee75d))


### Documentation

* add sample to run DML query ([#591](https://www.github.com/googleapis/python-bigquery/issues/591)) ([ff2ec3a](https://www.github.com/googleapis/python-bigquery/commit/ff2ec3abe418a443cd07751c08e654f94e8b3155))
* update the description of the return value of `_QueryResults.rows()` ([#594](https://www.github.com/googleapis/python-bigquery/issues/594)) ([8f4c0b8](https://www.github.com/googleapis/python-bigquery/commit/8f4c0b84dac3840532d7865247b8ad94b625b897))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
parthea pushed a commit that referenced this pull request Mar 9, 2026
@renovate-bot
chore(deps): update dependency certifi to v2025 (#597)
8e02904
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

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.

Return the new Key/Blob from gcloud.storage.bucket.upload_file_obj()

Uh oh!

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

4 participants

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