-
Notifications
You must be signed in to change notification settings - Fork 324
Closed
Labels
api: bigqueryIssues related to the googleapis/python-bigquery API.Issues related to the googleapis/python-bigquery API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Tested on latest (2.6.0) version, using python 3.8 on linux.
If ArrayQueryParameter
contaning at least one None
value is added to query_parameters
, when using job.query_parameters
(result after submitting the job) 'NoneType' object has no attribute 'mode'
will be raised.
This is because:
_from_api_repr_scalar
is called onArrayQueryParameter
_QUERY_PARAMS_FROM_JSON[array_type](value, None) for value in values
, thevalue
is None- this corresponds to
_int_from_json(None, None)
_not_null(None, None)
is calledreturn value is not None or field.mode != "NULLABLE"
raises exception
Stack trace:
AttributeError: 'NoneType' object has no attribute 'mode'
(snip)
File "(snip)/site-packages/google/cloud/bigquery/job/query.py", line 632, in query_parameters
return self._configuration.query_parameters
File "(snip)/site-packages/google/cloud/bigquery/job/query.py", line 314, in query_parameters
return _from_api_repr_query_parameters(prop)
File "(snip)/site-packages/google/cloud/bigquery/job/query.py", line 79, in _from_api_repr_query_parameters
return [_query_param_from_api_repr(mapping) for mapping in resource]
File "(snip)/site-packages/google/cloud/bigquery/job/query.py", line 79, in <listcomp>
return [_query_param_from_api_repr(mapping) for mapping in resource]
File "(snip)/site-packages/google/cloud/bigquery/query.py", line 632, in _query_param_from_api_repr
return klass.from_api_repr(resource)
File "(snip)/site-packages/google/cloud/bigquery/query.py", line 257, in from_api_repr
return cls._from_api_repr_scalar(resource)
File "(snip)/site-packages/google/cloud/bigquery/query.py", line 239, in _from_api_repr_scalar
converted = [
File "(snip)/site-packages/google/cloud/bigquery/query.py", line 240, in <listcomp>
_QUERY_PARAMS_FROM_JSON[array_type](value, None) for value in values
File "(snip)/site-packages/google/cloud/bigquery/_helpers.py", line 48, in _int_from_json
if _not_null(value, field):
File "(snip)/site-packages/google/cloud/bigquery/_helpers.py", line 43, in _not_null
return value is not None or field.mode != "NULLABLE"
kamilglod, abahdanovich, jacek-jablonski, utevo, mbielecki3 and 1 more
Metadata
Metadata
Assignees
Labels
api: bigqueryIssues related to the googleapis/python-bigquery API.Issues related to the googleapis/python-bigquery API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.