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 — feat: `read_session` optional to `ReadRowsStream.rows()` by tswast · Pull Request #228 · googleapis/python-bigquery-storage

This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Conversation

@tswast

@tswast tswast commented Jul 8, 2021

Copy link
Copy Markdown
Contributor

The schema from the first ReadRowsResponse message can be used to decode
messages, instead.

Note: to_arrow() and to_dataframe() do not work on an empty stream unless a
read_session has been passed in, as the schema is not available. This should
not affect google-cloud-bigquery and pandas-gbq, as those packages use the
lower-level message->dataframe/arrow methods.

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:

  • 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
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #168 🦕

Sorry, something went wrong.

Uh oh!

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

All reactions
@tswast
feat: read_session optional to ReadRowsStream.rows()
378db09
The schema from the first `ReadRowsResponse` message can be used to decode
messages, instead.

Note: `to_arrow()` and `to_dataframe()` do not work on an empty stream unless a
`read_session` has been passed in, as the schema is not available. This should
not affect `google-cloud-bigquery` and `pandas-gbq`, as those packages use the
lower-level message->dataframe/arrow methods.
@tswast
tswast requested review from a team and shollyman and removed request for a team July 8, 2021 19:19
@product-auto-label product-auto-label Bot added the api: bigquerystorage Issues related to the googleapis/python-bigquery-storage API. label Jul 8, 2021
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 8, 2021
@tswast
revert change to comment
ffc5df2
This was referenced Jul 8, 2021
show deprecation warning when read_session passed to ReadRowsStream.rows, ReadRowsStream.to_arrow, ReadRowsStream.to_dataframe googleapis/google-cloud-python#14281
Open
don't pass read_session to BQ Storage API rows from to_dataframe and to_arrow googleapis/python-bigquery#742
Closed
tseaver
tseaver reviewed Jul 8, 2021
View reviewed changes
Comment thread google/cloud/bigquery_storage_v1/reader.py Resolved

Uh oh!

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

Comment thread google/cloud/bigquery_storage_v1/reader.py Resolved

Uh oh!

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

Comment thread google/cloud/bigquery_storage_v1/reader.py Resolved

Uh oh!

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

Comment thread tests/system/conftest.py Resolved

Uh oh!

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

Comment thread tests/system/conftest.py Resolved

Uh oh!

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

@tswast @tseaver
use else for empty arrow streams in try-except block
0d693b3
Co-authored-by: Tres Seaver <[email protected]>
@google-cla

google-cla Bot commented Jul 8, 2021

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

All reactions

Sorry, something went wrong.

Uh oh!

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

@google-cla google-cla Bot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Jul 8, 2021
@tseaver

tseaver commented Jul 8, 2021

Copy link
Copy Markdown
Contributor

@googlebot I consent.

All reactions

Sorry, something went wrong.

Uh oh!

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

@google-cla

google-cla Bot commented Jul 8, 2021

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tseaver

tseaver commented Jul 8, 2021

Copy link
Copy Markdown
Contributor

@googlebot I fixed it.

All reactions

Sorry, something went wrong.

Uh oh!

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

@google-cla

google-cla Bot commented Jul 8, 2021

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tseaver

tseaver commented Jul 8, 2021

Copy link
Copy Markdown
Contributor

@tswast I give up on the CLA bit.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tswast
update docstring to reflect that readsession and readrowsresponse can…
dcb868b
… be used interchangeably
@google-cla

google-cla Bot commented Jul 8, 2021

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tswast

tswast commented Jul 8, 2021

Copy link
Copy Markdown
Contributor Author

@tswast I give up on the CLA bit.

No worries. I'll manually override the bot.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tswast
update arrow deserializer, too
2237694
@google-cla

google-cla Bot commented Jul 8, 2021

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tswast tswast added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Jul 8, 2021
@tswast
tswast requested a review from tseaver July 8, 2021 21:26
tseaver
tseaver approved these changes Jul 8, 2021
View reviewed changes
shollyman
shollyman approved these changes Jul 8, 2021
View reviewed changes
Comment thread tests/unit/test_reader_v1.py
avro_blocks = _bq_to_avro_blocks([], avro_schema)
reader = class_under_test(avro_blocks, mock_gapic_client, "", 0, {})

# Read session is needed to get a schema for empty streams.

@shollyman shollyman Jul 8, 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 think this is enough of a nuisance to request that empty streams always have at least one first response where the row data is null or empty?

Sorry, something went wrong.

Uh oh!

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

All reactions

@tswast tswast Jul 9, 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.

Maybe? I'm not sure how often it'll come up now that they don't do automatic rebalancing.

I'm actually considering deprecating this method altogether, as it didn't turn out to be all that necessary. https://github.com/googleapis/python-bigquery-storage/issues/230

Sorry, something went wrong.

Uh oh!

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

All reactions
@tswast
tswast merged commit 4f56029 into googleapis:master Jul 9, 2021
gcf-merge-on-green Bot pushed a commit that referenced this pull request Jul 9, 2021
@release-please
chore: release 2.6.0 (#227)
a309380
🤖 I have created a release \*beep\* \*boop\*
---
## [2.6.0](https://www.github.com/googleapis/python-bigquery-storage/compare/v2.5.0...v2.6.0) (2021-07-09)


### Features

* `read_session` optional to `ReadRowsStream.rows()` ([#228](https://www.github.com/googleapis/python-bigquery-storage/issues/228)) ([4f56029](https://www.github.com/googleapis/python-bigquery-storage/commit/4f5602950a0c1959e332aa2964245b9caf4828c8))
* add always_use_jwt_access ([#223](https://www.github.com/googleapis/python-bigquery-storage/issues/223)) ([fd82417](https://www.github.com/googleapis/python-bigquery-storage/commit/fd824174fb044fbacc83c647f619fda556333e26))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
@tswast
tswast deleted the issue168-read_session branch July 15, 2021 19:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@tseaver tseaver tseaver approved these changes
@shollyman shollyman shollyman approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

No one assigned

Labels

api: bigquerystorage Issues related to the googleapis/python-bigquery-storage API. 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.

feat: make read_session optional in ReadRowsStream.rows()

Uh oh!

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

3 participants

@tswast @tseaver @shollyman
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.