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 — ISSUE-41: Support storage api by alonme · Pull Request #61 · googleapis/python-bigquery-sqlalchemy

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

Conversation

@alonme

@alonme alonme commented Jun 26, 2020

Copy link
Copy Markdown
Contributor

closes #41

Sorry, something went wrong.

Uh oh!

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

All reactions
alonme added 3 commits June 26, 2020 23:07
@alonme
update gitignore to include mypy and .idea
6ff888c
@alonme
refactor create_connect_args
863651a
@alonme
Add bq storage client
2149ba4
@alonme
alonme force-pushed the support-storage-api branch from e947734 to 2149ba4 Compare June 26, 2020 21:39
alonme
alonme commented Jun 26, 2020
View reviewed changes
Comment thread dev_requirements.txt Outdated
sqlalchemy>=1.1.9
google-cloud-bigquery>=1.6.0
google-cloud-bigquery[bqstorage]>=1.25.0
google-cloud-bigquery-storage[fastavro]>=1.0.0

@alonme alonme Jun 26, 2020

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 am not sure what should be done concerning this.
fastavro was needed for the most basic functionality for me, and i think pyarrow may also be needed for other basic scenarios.
Should we include both as extras?

Sorry, something went wrong.

Uh oh!

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

All reactions

@tswast tswast Jun 26, 2020

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 is expected. googleapis/python-bigquery#55 updates the DB API implementation to use the Arrow wire format, but I believe hasn't been released yet.

Should we include both as extras?

Some thoughts:

  • The BigQuery Storage API is now GA, I'm more comfortable making a GA library a required dependency than when it was in Beta.
  • When we bump the minimum version of anything, it will generate some complaints.
  • The BigQuery Storage API, Arrow, and Avro all are a bit heavier of dependencies (contain compiled code). If we can avoid making these dependencies required, it will prevent some trouble.

How about we try to make these optional dependencies (extras) for now and revisit once there have been a few releases with Arrow support in the BQ DB-API?

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread setup.py Outdated
'sqlalchemy>=1.1.9',
'google-cloud-bigquery>=1.6.0',
'google-cloud-bigquery[bqstorage]>=1.25.0',
'google-cloud-bigquery-storage[fastavro]>=1.0.0',

@alonme alonme Jun 26, 2020

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.

See dev_requirements.txt comment

Sorry, something went wrong.

Uh oh!

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

All reactions
tswast
tswast reviewed Jun 26, 2020
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.

Thanks! A few comments. I think we need to make the BigQuery Storage API an optional dependency (at least for now).

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread dev_requirements.txt Outdated
sqlalchemy>=1.1.9
google-cloud-bigquery>=1.6.0
google-cloud-bigquery[bqstorage]>=1.25.0
google-cloud-bigquery-storage[fastavro]>=1.0.0

@tswast tswast Jun 26, 2020

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 is expected. googleapis/python-bigquery#55 updates the DB API implementation to use the Arrow wire format, but I believe hasn't been released yet.

Should we include both as extras?

Some thoughts:

  • The BigQuery Storage API is now GA, I'm more comfortable making a GA library a required dependency than when it was in Beta.
  • When we bump the minimum version of anything, it will generate some complaints.
  • The BigQuery Storage API, Arrow, and Avro all are a bit heavier of dependencies (contain compiled code). If we can avoid making these dependencies required, it will prevent some trouble.

How about we try to make these optional dependencies (extras) for now and revisit once there have been a few releases with Arrow support in the BQ DB-API?

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread pybigquery/sqlalchemy_bigquery.py Outdated

from google import auth
from google.cloud import bigquery
from google.cloud import bigquery, bigquery_storage_v1beta1

@tswast tswast Jun 26, 2020

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 believe the bigquery_storage_v1 library now works with the DB-API now. Let's use that, since it points to the GA endpoint.

Also, if we make the BQ Storage library an "extra", then let's catch any import errors to make this an optional dependency.

Sorry, something went wrong.

Uh oh!

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

All reactions
@alonme

alonme commented Aug 1, 2020

Copy link
Copy Markdown
Contributor Author

@tswast its a bit of a funny situation, we can't work with a storage api with google-cloud-bigquery < 1.25.0, and we can't use the V1 with less then 1.26.
However, if the user does have 1.26, and the bqstorage extras, than the use_bqstorage_api flag is irrelevant as it is used by default in 1.26.

i will try and make it work without changing the current dependencies, but it feels to me like we should try and move to 1.26, if there are not many breaking changes between 1.12 and 1.26 (current is 1.6, but it seems we already break with anything below 1.12)

All reactions

Sorry, something went wrong.

Uh oh!

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

@alonme
Fix requirements, handle missing requirements
47d0310
@alonme
alonme force-pushed the support-storage-api branch from e6cbc1f to 47d0310 Compare August 1, 2020 15:09
alonme
alonme commented Aug 1, 2020
View reviewed changes
Comment thread dev_requirements.txt
@@ -1,6 +1,7 @@
sqlalchemy>=1.1.9
google-cloud-bigquery>=1.6.0
google-cloud-bigquery>=1.12.0

@alonme alonme Aug 1, 2020

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.

the module doesn't work with anything below that ( also in master)

Sorry, something went wrong.

Uh oh!

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

All reactions
@alonme
alonme requested a review from tswast August 6, 2020 19:15
@tswast

tswast commented Aug 11, 2020

Copy link
Copy Markdown
Contributor

its a bit of a funny situation, we can't work with a storage api with google-cloud-bigquery < 1.25.0, and we can't use the V1 with less then 1.26. However, if the user does have 1.26, and the bqstorage extras, than the use_bqstorage_api flag is irrelevant as it is used by default in 1.26.

@alonme I didn't realize that the DB-API is using the BigQuery Storage API by default now. That's actually really good news. I wonder if that means we can drop this PR altogether? Or do you think it'd be useful to be able to explicitly enable/disable this API usage?

All reactions

Sorry, something went wrong.

Uh oh!

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

@alonme

alonme commented Aug 12, 2020

Copy link
Copy Markdown
Contributor Author

@tswast Its used by default for version 1.26 (which we don't require) and only if you install the extra dependencies.

The storage api has different pricing than the regular queries, so it kind of makes sense to me, however they are using it as default in the DB-API...

We will probably want to add an option to install the extras through this package,
Another question is if we should reflect the usage of the storage api to the user in any way? reflect that he misses dependencies needed to use it?

This PR also contains some refactoring and fixing a requirements issue - so if we decide to not use it - i'll open another one for these changes

All reactions

Sorry, something went wrong.

Uh oh!

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

@tswast

tswast commented Aug 12, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

The storage api has different pricing than the regular queries, so it kind of makes sense to me, however they are using it as default in the DB-API...

It's actually free to download results from query results tables and can be used with BigQuery Sandbox, so it shouldn't make a difference regarding pricing.

The number of bytes read includes data used for filtering but not returned to you as output from ReadRows. You are not charged for data read from temporary tables.

(from https://cloud.google.com/bigquery/pricing#storage-api)

It is an extra API to enable and extra packages to install, so there will certainly be some users who aren't able to use it. 🤔

All reactions

Sorry, something went wrong.

Uh oh!

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

@alonme

alonme commented Aug 27, 2020

Copy link
Copy Markdown
Contributor Author

So what do we want to do with this?

All reactions

Sorry, something went wrong.

Uh oh!

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

tswast
tswast reviewed Aug 27, 2020
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.

Looking at the DB-API docs, it looks like it's not actually possible to explicitly disable the BQ Storage API with the DB-API. That makes setting an option to False a bit misleading. If we do want to proceed with this PR, we should file an issue on https://github.com/googleapis/python-bigquery to have a way to disable using the BQ Storage API.

Probably worth waiting to see if folks have trouble with the current default behavior before filing that, though.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread pybigquery/sqlalchemy_bigquery.py
if parse_version(bigquery.__version__) >= Version("1.26.0"):
try:
storage_client = bigquery_storage_v1.BigQueryReadClient(credentials=credentials)
clients.append(storage_client)

@tswast tswast Aug 27, 2020

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.

Since bqstorage_client is an optional argument to connect(), we should probably be using the dictionary for this rather than appending to the list of positional arguments. (In fact, maybe we should do the same for the BigQuery client object, too)

Sorry, something went wrong.

Uh oh!

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

All reactions
@tswast

tswast commented Jan 7, 2021

Copy link
Copy Markdown
Contributor

Closing, since there doesn't seem to be demand for turning off the BigQuery Storage API support and that API is now used by default.

Thank you for your investigation and work on this @alonme!

All reactions

Sorry, something went wrong.

Uh oh!

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

@tswast tswast closed this Jan 7, 2021
This was referenced Apr 7, 2021
Support of Storage API #41
Closed
feat: add BigQuery storage client support to DB API googleapis/python-bigquery#36
Merged
@galloviolet

galloviolet commented May 15, 2024

Copy link
Copy Markdown

Looking at the DB-API docs, it looks like it's not actually possible to explicitly disable the BQ Storage API with the DB-API. That makes setting an option to False a bit misleading. If we do want to proceed with this PR, we should file an issue on https://github.com/googleapis/python-bigquery to have a way to disable using the BQ Storage API.

Probably worth waiting to see if folks have trouble with the current default behavior before filing that, though.

Opened googleapis/python-bigquery#1920.

All reactions

Sorry, something went wrong.

Uh oh!

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer
@tswast tswast tswast left review comments
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

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Support of Storage API

Uh oh!

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

3 participants

@alonme @tswast @galloviolet
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.