Mohan_2523
Mohan_2523

Reputation: 85

BigQuery Client using Python | Timeout and Polling issues

I am trying to execute a SQL statement on BQ Database by initializing the BQ Client. This has been running smoothly for a while but lately seeing an issue.

My code specifically fails when its trying to wait for the results from the DB

query_job = client.query(QUERY)  # API request to start the query    
db_rslt = query_job.result()     # Wait for the query to return results

Here is error message:

File "/opt/conda/default/lib/python3.7/site-packages/google/cloud/bigquery/job.py", line xxx, in result super(QueryJob, self).result(retry=retry, timeout=timeout) File "/opt/conda/default/lib/python3.7/site-packages/google/cloud/bigquery/job.py", line xxx, in result return super(_AsyncJob, self).result(timeout=timeout) File "/opt/conda/default/lib/python3.7/site-packages/google/api_core/future/polling.py", line xxx, in result self._blocking_poll(timeout=timeout, retry=retry, polling=polling) TypeError: _blocking_poll() got an unexpected keyword argument 'retry'

Added the timeout parameter to the result method but did not help

Upvotes: 8

Views: 11623

Answers (5)

kalona
kalona

Reputation: 21

This did the trick for me, although I was having this issue on Kaggle notebooks:

pip install -U google-cloud-bigquery google-api-core==1.33.2

Also the v2 version of google-api-core seems to work:

google-api-core==2.11.0

https://github.com/googleapis/python-api-core/releaseshttps://github.com/googleapis/python-api-core/releases

Upvotes: 2

Jim LK Yu
Jim LK Yu

Reputation: 178

This also happened to me. My python image is 3.8.13:bulleye. It was using the following stack of google library.

google-auth==1.33.0
google-cloud-bigquery==1.25.0
google-cloud-firestore==2.3.1

Changing them to

db-dtypes==1.0.0
google-auth==2.6.0
google-cloud-bigquery==3.0.1
google-cloud-firestore==2.5.3

solved the problems.

db-dtypes is required for new version of google cloud library.

Upvotes: 0

SparklinZ
SparklinZ

Reputation: 66

7 days ago Google released an update to google-api-core==1.34.0 for bug fixes. I guess this introduced some breaking changes if you are not using the later versions of google-cloud-bigquery. You may either:

  1. Pin google-api-core to the previous working version (eg. 1.33.2)
  2. Upgrade google-cloud-bigquery to the latest versions.

Upvotes: 5

Charbel
Charbel

Reputation: 61

It depends on the version of your installed google-cloud-bigquery library, if you are using a 1.x version, make sure to set google-api-core to a version less than 1.34.0.

What is actually happening here is that when you install google-cloud-bigquery, a bunch of other google related libraries are installed automatically with it, google-api-core is one of these libraries. However, a higher version is being installed thus causing this problem.

In my case, setting my google-api-core==1.33.2 solves the issue. Other solution would be is to upgrade google-cloud-bigquery to a later version .

Upvotes: 6

Jahd Jabre
Jahd Jabre

Reputation: 55

I solved it by changing the bigquery version to the latest: 'google-cloud-bigquery==3.4.0'.

Upvotes: 0

Related Questions