As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

StreamedResultSet API

Wrapper for streaming results.

class google.cloud.spanner_v1.streamed.StreamedResultSet(response_iterator, source=None, column_info=None)[source]

Bases: object

Process a sequence of partial result sets into a single set of row data.

Parameters
  • response_iterator – Iterator yielding PartialResultSet instances.

  • source (Snapshot) – Snapshot from which the result set was fetched.

property fields

Field descriptors for result set columns.

Return type

list of Field

Returns

list of fields describing column names / types.

property metadata

Result set metadata

Return type

ResultSetMetadata

Returns

structure describing the results

one()[source]

Return exactly one result, or raise an exception.

Raises

NotFound: If there are no results.

Raises

ValueError: If there are multiple results.

Raises

RuntimeError: If consumption has already occurred, in whole or in part.

one_or_none()[source]

Return exactly one result, or None if there are no results.

Raises

ValueError: If there are multiple results.

Raises

RuntimeError: If consumption has already occurred, in whole or in part.

property stats

Result set statistics

Return type

ResultSetStats

Returns

structure describing status about the response

to_dict_list()[source]

Return the result of a query as a list of dictionaries. In each dictionary the key is the column name and the value is the value of the that column in a given row.

Return type

list of dict

Returns

result rows as a list of dictionaries

exception google.cloud.spanner_v1.streamed.Unmergeable(lhs, rhs, type_)[source]

Bases: ValueError

Unable to merge two values.

Parameters
  • lhs (Value) – pending value to be merged

  • rhs (Value) – remaining value to be merged

  • type (Type) – field type of values being merged