-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.
Description
- OS type and version - Ubuntu 16.04.1 LTS
- Python version and virtual environment information
python --version- 2.7.12 - google-cloud-python version
pip show google-cloud,pip show google-<service>orpip freeze- 0.21.0 - Stacktrace if available
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-23-1528bd7c380f> in <module>()
----> 1 job.rows()
/home/mtebeka/python-docs-samples/appengine/flexible/hello_world/venv/local/lib/python2.7/site-packages/google/cloud/bigquery/query.pyc in rows(self)
225 :returns: fields describing the schema (None until set by the server).
226 """
--> 227 return _rows_from_json(self._properties.get('rows', ()), self.schema)
228
229 @property
/home/mtebeka/python-docs-samples/appengine/flexible/hello_world/venv/local/lib/python2.7/site-packages/google/cloud/bigquery/_helpers.pyc in _rows_from_json(rows, schema)
114 def _rows_from_json(rows, schema):
115 """Convert JSON row data to rows with appropriate types."""
--> 116 return [_row_from_json(row, schema) for row in rows]
117
118
/home/mtebeka/python-docs-samples/appengine/flexible/hello_world/venv/local/lib/python2.7/site-packages/google/cloud/bigquery/_helpers.pyc in _row_from_json(row, schema)
105 if field.mode == 'REPEATED':
106 row_data.append([converter(item, field)
--> 107 for item in cell['v']])
108 else:
109 row_data.append(converter(cell['v'], field))
/home/mtebeka/python-docs-samples/appengine/flexible/hello_world/venv/local/lib/python2.7/site-packages/google/cloud/bigquery/_helpers.pyc in _float_from_json(value, field)
33 """Coerce 'value' to a float, if set or not nullable."""
34 if _not_null(value, field):
---> 35 return float(value)
36
37
TypeError: float() argument must be a string or a number
- Steps to reproduce - Run a query with
APPROX_QUANTILES. - Code example
from google.cloud import bigquery
client = bigquery.Client(project='PROJECT-ID')
sql = '''
SELECT
APPROX_QUANTILES(
CASE
WHEN ctr_before = 0 THEN NULL
ELSE (ctr_after - ctr_before) / ctr_before
END,
100) quantile
FROM
`ltv.user_ctr`
'''
job = client.run_sync_query(sql)
job.use_legacy_sql = False
job.run()
job.rowsMetadata
Metadata
Assignees
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.