googleapis/python-bigquery

Allow enabling/disabling the storage API on a per-connection basis

gallodustin opened this issue · 2 comments

In #16, support was added for the BigQuery storage API in the form of a bqstorage_client which is passed to or created by connect(). Yet there is no way, other than installing or uninstalling the storage API itself, to toggle whether the storage API is enabled/disabled.

Since use of the storage API does affect pricing, it would be preferable to enable or disable on a per-connection basis, perhaps as a use_storage_api: bool parameter on connect(). This way, callers could choose at will whether to use the storage API without having to change the Python environment the code is running in.

As a hack to workaround this issue, I attempted calling connect passing a normal Client object rather than a BigQueryReadClient in the bqstorage_client parameter, but this does not create a functioning usable connection.

Since use of the storage API does affect pricing,

Not really true when we're talking about query results. My understanding is that BQ Storage Reads are free from anonymous query result tables.

That said, there could be other reasons not to use this. In to_dataframe, one can set create_bqstorage_client=False to disable the automatic behavior, for example.