Closed
Description
I ran into the following exception when using the pandas read_gbq()
function.
1 import pandas as pd
----> 2 pd.read_gbq('select * from SampleDataset.SampleTable', project_id='xxxxxxx')
/usr/local/lib/python2.7/dist-packages/pandas/io/gbq.pyc in read_gbq(query, project_id, index_col, col_order, reauth, verbose)
425 job_id = uuid.uuid4().hex
426 rows = []
--> 427 remaining_rows = len(dataframe)
428
429 if self.verbose:
/usr/local/lib/python2.7/dist-packages/pandas/io/gbq.pyc in __init__(self, project_id, reauth)
111 not match the schema of the destination
112 table in BigQuery.
--> 113 """
114 pass
115
/usr/local/lib/python2.7/dist-packages/pandas/io/gbq.pyc in test_google_api_imports(self)
127 Raised when BigQuery reports a streaming insert error.
128 For more information see `Streaming Data Into BigQuery
--> 129 <https://cloud.google.com/bigquery/streaming-data-into-bigquery>`__
130 """
131
ImportError: Missing module required for Google BigQuery support: No module named discovery
An exception occurs in test_google_api_imports()
. I believe the issue is on line 49 in https://github.com/pydata/pandas/blob/master/pandas/io/gbq.py .
We use
from apiclient.discovery import build
instead of
from googleapiclient.discovery import build
apiclient
is an alias for googleapiclient
according to https://github.com/google/google-api-python-client/blob/master/apiclient/__init__.py#L1
A similar issue is reported here: googleapis/google-api-python-client#13
apiclient.__version__
fails
>> import apiclient
>> apiclient.__version__
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-90-662a0f56e34b> in <module>()
1 import apiclient
----> 2 apiclient.__version__
AttributeError: 'module' object has no attribute '__version__'
googleapiclient.__version__
works
import googleapiclient
googleapiclient.__version__
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.9.final.0
python-bits: 64
OS: Linux
OS-release: 3.16.0-4-amd64
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: None
pandas: None
nose: 1.3.7
pip: 1.5.6
setuptools: 5.5.1
Cython: 0.24
numpy: 1.10.4
scipy: 0.17.0
statsmodels: 0.6.1
IPython: 4.0.3
sphinx: None
patsy: 0.4.1
dateutil: 2.4.2
pytz: 2015.7
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
httplib2: 0.9.2
apiclient: 1.5.1
sqlalchemy: None
pymysql: None
psycopg2: None
Jinja2: None