Keyset API#

Wrap representation of Spanner keys / ranges.

class google.cloud.spanner.keyset.KeyRange(start_open=None, start_closed=None, end_open=None, end_closed=None)[source]#

Bases: object

Identify range of table rows via start / end points.

Parameters:
  • start_open (list of scalars) – keys identifying start of range (this key excluded)
  • start_closed (list of scalars) – keys identifying start of range (this key included)
  • end_open (list of scalars) – keys identifying end of range (this key excluded)
  • end_closed (list of scalars) – keys identifying end of range (this key included)
to_pb()[source]#

Construct a KeyRange protobuf.

Return type:KeyRange
Returns:protobuf corresponding to this instance.
class google.cloud.spanner.keyset.KeySet(keys=(), ranges=(), all_=False)[source]#

Bases: object

Identify table rows via keys / ranges.

Parameters:
  • keys (list of list of scalars) – keys identifying individual rows within a table.
  • ranges (list of KeyRange) – ranges identifying rows within a table.
  • all (boolean) – if True, identify all rows within a table
to_pb()[source]#

Construct a KeySet protobuf.

Return type:KeySet
Returns:protobuf corresponding to this instance.