ofek/pypinfo

google-cloud-bigquery 0.29.0: AttributeError: 'QueryJob' object has no attribute 'query_results'

hugovk opened this issue · 1 comments

I upgraded google-cloud-bigquery and get AttributeError: 'QueryJob' object has no attribute 'query_results'.

This also happens when installing pypinfo in a fresh environment.

Downgrading back to the previous 0.28.0 works.

$ python --version
Python 3.6.4
$ pypinfo --version
pypinfo, version 7.0.0

Upgrade to google-cloud-bigquery==0.29.0

$  pip install -U google-cloud-bigquery
Collecting google-cloud-bigquery
  Downloading google_cloud_bigquery-0.29.0-py2.py3-none-any.whl (67kB)
    100% |████████████████████████████████| 71kB 890kB/s
Collecting google-api-core<0.2.0dev,>=0.1.1 (from google-cloud-bigquery)
  Downloading google_api_core-0.1.3-py2.py3-none-any.whl (49kB)
    100% |████████████████████████████████| 51kB 1.8MB/s
Requirement already up-to-date: requests>=2.18.0 in /usr/local/lib/python3.6/site-packages (from google-cloud-bigquery)
Requirement already up-to-date: google-cloud-core<0.29dev,>=0.28.0 in /usr/local/lib/python3.6/site-packages (from google-cloud-bigquery)
Requirement already up-to-date: google-auth>=1.0.0 in /usr/local/lib/python3.6/site-packages (from google-cloud-bigquery)
Requirement already up-to-date: google-resumable-media>=0.2.1 in /usr/local/lib/python3.6/site-packages (from google-cloud-bigquery)
Collecting protobuf>=3.0.0 (from google-api-core<0.2.0dev,>=0.1.1->google-cloud-bigquery)
  Downloading protobuf-3.5.1-py2.py3-none-any.whl (388kB)
    100% |████████████████████████████████| 389kB 1.1MB/s
Collecting pytz (from google-api-core<0.2.0dev,>=0.1.1->google-cloud-bigquery)
  Downloading pytz-2017.3-py2.py3-none-any.whl (511kB)
    100% |████████████████████████████████| 512kB 1.3MB/s
Requirement already up-to-date: googleapis-common-protos<2.0dev,>=1.5.3 in /usr/local/lib/python3.6/site-packages (from google-api-core<0.2.0dev,>=0.1.1->google-cloud-bigquery)
Requirement already up-to-date: six>=1.10.0 in /usr/local/lib/python3.6/site-packages (from google-api-core<0.2.0dev,>=0.1.1->google-cloud-bigquery)
Collecting setuptools>=34.0.0 (from google-api-core<0.2.0dev,>=0.1.1->google-cloud-bigquery)
  Using cached setuptools-38.4.0-py2.py3-none-any.whl
Requirement already up-to-date: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/site-packages/chardet-3.0.4-py3.6.egg (from requests>=2.18.0->google-cloud-bigquery)
Requirement already up-to-date: urllib3<1.23,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests>=2.18.0->google-cloud-bigquery)
Requirement already up-to-date: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests>=2.18.0->google-cloud-bigquery)
Requirement already up-to-date: idna<2.7,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests>=2.18.0->google-cloud-bigquery)
Requirement already up-to-date: pyasn1-modules>=0.0.5 in /usr/local/lib/python3.6/site-packages (from google-auth>=1.0.0->google-cloud-bigquery)
Requirement already up-to-date: pyasn1>=0.1.7 in /usr/local/lib/python3.6/site-packages (from google-auth>=1.0.0->google-cloud-bigquery)
Requirement already up-to-date: rsa>=3.1.4 in /usr/local/lib/python3.6/site-packages (from google-auth>=1.0.0->google-cloud-bigquery)
Requirement already up-to-date: cachetools>=2.0.0 in /usr/local/lib/python3.6/site-packages (from google-auth>=1.0.0->google-cloud-bigquery)
Installing collected packages: setuptools, protobuf, pytz, google-api-core, google-cloud-bigquery
  Found existing installation: setuptools 38.2.5
    Uninstalling setuptools-38.2.5:
      Successfully uninstalled setuptools-38.2.5
  Found existing installation: protobuf 3.5.0.post1
    Uninstalling protobuf-3.5.0.post1:
      Successfully uninstalled protobuf-3.5.0.post1
  Found existing installation: pytz 2017.2
    Uninstalling pytz-2017.2:
      Successfully uninstalled pytz-2017.2
  Found existing installation: google-api-core 0.1.1
    Uninstalling google-api-core-0.1.1:
      Successfully uninstalled google-api-core-0.1.1
  Found existing installation: google-cloud-bigquery 0.28.0
    Uninstalling google-cloud-bigquery-0.28.0:
      Successfully uninstalled google-cloud-bigquery-0.28.0
Successfully installed google-api-core-0.1.3 google-cloud-bigquery-0.29.0 protobuf-3.5.1 pytz-2017.3 setuptools-38.4.0
$ pip freeze | grep google
google-api-core==0.1.3
google-auth==1.2.1
google-cloud-bigquery==0.29.0
google-cloud-core==0.28.0
google-resumable-media==0.3.1
googleapis-common-protos==1.5.3
$ pypinfo --percent --pip --markdown packaging pyversion
Traceback (most recent call last):
  File "/usr/local/bin/pypinfo", line 11, in <module>
    load_entry_point('pypinfo', 'console_scripts', 'pypinfo')()
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/hugo/github/pypinfo/pypinfo/cli.py", line 103, in pypinfo
    rows = parse_query_result(query_job, query_rows)
  File "/Users/hugo/github/pypinfo/pypinfo/core.py", line 98, in parse_query_result
    rows = [[field.name for field in query_job.query_results().schema]]
AttributeError: 'QueryJob' object has no attribute 'query_results'

Downgrade to google-cloud-bigquery==0.28.0

$ pip install google-cloud-bigquery==0.28.0
ollecting google-cloud-bigquery==0.28.0
  Using cached google_cloud_bigquery-0.28.0-py2.py3-none-any.whl
Requirement already satisfied: google-auth>=1.0.0 in /usr/local/lib/python3.6/site-packages (from google-cloud-bigquery==0.28.0)
Requirement already satisfied: google-resumable-media>=0.2.1 in /usr/local/lib/python3.6/site-packages (from google-cloud-bigquery==0.28.0)
Requirement already satisfied: google-api-core<0.2.0dev,>=0.1.1 in /usr/local/lib/python3.6/site-packages (from google-cloud-bigquery==0.28.0)
Requirement already satisfied: requests>=2.18.0 in /usr/local/lib/python3.6/site-packages (from google-cloud-bigquery==0.28.0)
Requirement already satisfied: google-cloud-core<0.29dev,>=0.28.0 in /usr/local/lib/python3.6/site-packages (from google-cloud-bigquery==0.28.0)
Requirement already satisfied: rsa>=3.1.4 in /usr/local/lib/python3.6/site-packages (from google-auth>=1.0.0->google-cloud-bigquery==0.28.0)
Requirement already satisfied: pyasn1>=0.1.7 in /usr/local/lib/python3.6/site-packages (from google-auth>=1.0.0->google-cloud-bigquery==0.28.0)
Requirement already satisfied: six>=1.9.0 in /usr/local/lib/python3.6/site-packages (from google-auth>=1.0.0->google-cloud-bigquery==0.28.0)
Requirement already satisfied: pyasn1-modules>=0.0.5 in /usr/local/lib/python3.6/site-packages (from google-auth>=1.0.0->google-cloud-bigquery==0.28.0)
Requirement already satisfied: cachetools>=2.0.0 in /usr/local/lib/python3.6/site-packages (from google-auth>=1.0.0->google-cloud-bigquery==0.28.0)
Requirement already satisfied: setuptools>=34.0.0 in /usr/local/lib/python3.6/site-packages (from google-api-core<0.2.0dev,>=0.1.1->google-cloud-bigquery==0.28.0)
Requirement already satisfied: protobuf>=3.0.0 in /usr/local/lib/python3.6/site-packages (from google-api-core<0.2.0dev,>=0.1.1->google-cloud-bigquery==0.28.0)
Requirement already satisfied: googleapis-common-protos<2.0dev,>=1.5.3 in /usr/local/lib/python3.6/site-packages (from google-api-core<0.2.0dev,>=0.1.1->google-cloud-bigquery==0.28.0)
Requirement already satisfied: pytz in /usr/local/lib/python3.6/site-packages (from google-api-core<0.2.0dev,>=0.1.1->google-cloud-bigquery==0.28.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/site-packages/chardet-3.0.4-py3.6.egg (from requests>=2.18.0->google-cloud-bigquery==0.28.0)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests>=2.18.0->google-cloud-bigquery==0.28.0)
Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests>=2.18.0->google-cloud-bigquery==0.28.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests>=2.18.0->google-cloud-bigquery==0.28.0)
Installing collected packages: google-cloud-bigquery
  Found existing installation: google-cloud-bigquery 0.29.0
    Uninstalling google-cloud-bigquery-0.29.0:
      Successfully uninstalled google-cloud-bigquery-0.29.0
Successfully installed google-cloud-bigquery-0.28.0
$ pip freeze | grep google
google-api-core==0.1.3
google-auth==1.2.1
google-cloud-bigquery==0.28.0
google-cloud-core==0.28.0
google-resumable-media==0.3.1
googleapis-common-protos==1.5.3
$ pypinfo --percent --pip --markdown packaging pyversion

| python_version | percent | download_count |
| -------------- | ------: | -------------: |
| 2.7            |   69.0% |        504,306 |
| 3.4            |   11.3% |         82,356 |
| 3.6            |    9.3% |         67,912 |
| 3.5            |    5.9% |         42,973 |
| 2.6            |    4.1% |         30,254 |
| 3.3            |    0.3% |          1,852 |
| 3.7            |    0.1% |            761 |
| None           |    0.0% |             31 |
| 3.2            |    0.0% |              1 |
ofek commented

Thanks!