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: use BigQuery Storage client by default by plamut · Pull Request #55 · googleapis/python-bigquery

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

Conversation

@plamut

@plamut plamut commented Mar 9, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Closes #86.
Closes #84.

No issue yet, just a POC preview.

The PR is now ready to be reviewed. It uses the BQ Storage API by default to fetch query results, and removes the "beta" label from that feature.

It's probably easier to review this PR commit by commit.

Key points:

  • If BQ Storage client cannot be used (e.g. missing dependencies) to fetch query results, the library falls back to the REST API.
  • The BQ storage API v1 stable is now used, replacing v1beta1 client (however, there is a feature request to support both BQ Storage client versions simultaneously).
  • The Python DB API now more closely follows the specs. Closing a connection instance makes it unusable from that point on, and also closes every Cursor instance created by it.
  • Closing a DB API Connection now also closes the BigQuery / BQ Storage clients the latter has created, fixing the sockets leak discovered.

Sorry, something went wrong.

Uh oh!

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

All reactions
@plamut plamut added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Mar 9, 2020
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 9, 2020
@plamut
plamut force-pushed the optimize-to-dataframe branch from 25572ab to 1bb7283 Compare March 11, 2020 13:27
@plamut

plamut commented Apr 7, 2020

Copy link
Copy Markdown
Contributor Author

I did some timings to compare fetching data with and without the BQ Storage client, results below. Spoiler: When using the BQ Storage API, performance improvements are enormous.

Query

SELECT * FROM `project.dataset.table`
LIMIT 200000

Source tables

  • A synthetic table with two FLOAT columns containing 10M rows of random numbers
  • bigquery-public-data-cms_medicare.inpatient_charges_2011 - multiple numeric and string columns, contains ~163k rows.

Timings

REST API (tabledata.list) BQ Storage API
Synthetic table 10 - 11.5 s 4.5 - 5 s
Inpatient charges table 23 - 25s 10.5 - 12.5 s
All reactions

Sorry, something went wrong.

Uh oh!

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

@plamut
plamut force-pushed the optimize-to-dataframe branch from fde9441 to c01648d Compare April 14, 2020 13:28
@plamut
plamut force-pushed the optimize-to-dataframe branch 4 times, most recently from f080813 to 1aa0c62 Compare April 28, 2020 07:59
@plamut plamut removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Apr 28, 2020
@plamut plamut mentioned this pull request Apr 28, 2020
BigQuery Storage API integrations should accept either v1beta1 or v1 client #84
Closed
@plamut
plamut requested a review from shollyman April 28, 2020 08:18
@plamut
plamut marked this pull request as ready for review April 28, 2020 08:29
plamut added 4 commits April 28, 2020 10:37
@plamut
feat: use BigQuery Storage client by default
d3d8525
@plamut
Use BQ Storage API by default in cell magic
6e678ce
@plamut
Add raise_on_closed helper decorator to DB API
d544a69
@plamut
Use BigQuery Storage API by default in DB API
2cd32d3
@plamut
plamut force-pushed the optimize-to-dataframe branch from 1aa0c62 to 3f73a43 Compare April 28, 2020 08:37
plamut added 3 commits April 28, 2020 14:21
@plamut
Use BQ Storage v1 stable version in main client
3b1a52a
@plamut
Use BQ Storage v1 stable in BigQuery cell magic
384b5d6
@plamut
Use BQ Storage v1 stable in DB API
00bf584
@plamut
plamut force-pushed the optimize-to-dataframe branch from 3f73a43 to 00bf584 Compare April 28, 2020 12:22
tswast
tswast reviewed Apr 28, 2020
View reviewed changes
Comment thread google/cloud/bigquery/_pandas_helpers.py Resolved

Uh oh!

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

@plamut plamut mentioned this pull request Apr 30, 2020
chore: remove local test_utils directory #89
Merged
4 tasks done
plamut and others added 2 commits April 30, 2020 10:16
@plamut
Merge branch 'master' into optimize-to-dataframe
7d7dc73
@plamut
Support both v1 stable and beta1 BQ Storage client
dbef14d
@plamut
plamut force-pushed the optimize-to-dataframe branch from 12b2171 to dbef14d Compare April 30, 2020 16:24
shollyman
shollyman reviewed May 11, 2020
View reviewed changes

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

Semantic satiation seeing all the v1/v1beta references. Sorry it took me so long to get to this. Couple minor nits, with a couple more interesting bits (avro vs arrow, small result set, versioning for storage).

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread google/cloud/bigquery/dbapi/cursor.py Resolved

Uh oh!

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

Comment thread google/cloud/bigquery/dbapi/cursor.py Resolved

Uh oh!

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

Comment thread google/cloud/bigquery/job.py Resolved

Uh oh!

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

Comment thread setup.py Resolved

Uh oh!

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

Comment thread tests/system.py Resolved

Uh oh!

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

Comment thread tests/system.py Resolved

Uh oh!

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

plamut added 2 commits May 13, 2020 13:46
@plamut
Merge branch 'master' into optimize-to-dataframe
4abd932
@plamut
Fix some typos and redundant Beta mark
530a5db
@plamut plamut mentioned this pull request May 13, 2020
Remove workarounds for the BQ Storage API issue with small result sets #106
Closed
@plamut
plamut force-pushed the optimize-to-dataframe branch 2 times, most recently from 5b82c76 to c715a74 Compare May 14, 2020 13:27
@plamut
plamut requested a review from shollyman May 14, 2020 14:10
plamut and others added 2 commits May 14, 2020 17:07
@plamut
Use ARROW as data format in DB API cursor
c6e0133
@shollyman @plamut
feat: add HOUR support for time partitioning interval (googleapis#91)
6e35d09
* feat: add HOUR support for time partitioning interval
@plamut
plamut force-pushed the optimize-to-dataframe branch from 486309f to 6e35d09 Compare May 14, 2020 15:08
@plamut
Merge branch 'master' into optimize-to-dataframe
1c75225
shollyman
shollyman approved these changes May 15, 2020
View reviewed changes

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

Thanks for the slogging through this.

Sorry, something went wrong.

Uh oh!

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

All reactions
@plamut

plamut commented May 15, 2020

Copy link
Copy Markdown
Contributor Author

Just a thought - since this is a pretty significant change, how about releasing all the other smaller changes and fixes that have accumulated since the last release separately, and release this one separately for an easier rollback, should that be necessary?

All reactions

Sorry, something went wrong.

Uh oh!

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

@shollyman

shollyman commented May 15, 2020

Copy link
Copy Markdown
Contributor

Isolating this change to its own release seems prudent.

All reactions

Sorry, something went wrong.

Uh oh!

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

@plamut

plamut commented May 19, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

Putting this on hold until the next release is made, we will ship it separately.

All reactions

Sorry, something went wrong.

Uh oh!

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

@plamut plamut added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label May 19, 2020
@plamut plamut mentioned this pull request May 19, 2020
Pagination should allow fetching pages in batch of N pages. #112
Closed
@shollyman shollyman mentioned this pull request Jun 9, 2020
doc: update wording in rowiterator docstrings to reduce confusion #127
Merged
plamut added 2 commits June 10, 2020 17:00
@plamut
Merge branch 'master' into optimize-to-dataframe
bd9b7c8
@plamut
Bump BQ storage pin to stable version.
7294605
@plamut plamut removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jun 10, 2020
@plamut
plamut requested a review from shollyman June 10, 2020 15:02
@plamut

plamut commented Jun 10, 2020

Copy link
Copy Markdown
Contributor Author

With the new release (1.25.0) now out, we can now merge this and release in the near future (possibly with miscellaneous related cleanup fixes).

All reactions

Sorry, something went wrong.

Uh oh!

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

shollyman
shollyman approved these changes Jun 10, 2020
View reviewed changes
@plamut
plamut merged commit e75ff82 into googleapis:master Jun 10, 2020
@plamut
plamut deleted the optimize-to-dataframe branch June 10, 2020 21:20
@tswast tswast mentioned this pull request Jun 26, 2020
ISSUE-41: Support storage api googleapis/python-bigquery-sqlalchemy#61
Closed
@derekperkins derekperkins mentioned this pull request Apr 1, 2021
bigquery: enable transparent storage api usage googleapis/google-cloud-go#3880
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@tswast tswast tswast left review comments
@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

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.

Use BQ Storage API by default BigQuery Storage API integrations should accept either v1beta1 or v1 client

Uh oh!

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

4 participants

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