FieldRange

class borneo.FieldRange(field_path)[source]

Bases: object

FieldRange defines a range of values to be used in a NoSQLHandle.multi_delete() operation, as specified in MultiDeleteRequest.set_range(). FieldRange is only relevant if a primary key has multiple components because all values in the range must share the same shard key.

FieldRange is used as the least significant component in a partially specified key value in order to create a value range for an operation that returns multiple rows or keys. The data types supported by FieldRange are limited to the atomic types which are valid for primary keys.

The least significant component of a key is the first component of the key that is not fully specified. For example, if the primary key for a table is defined as the tuple (a, b, c), a FieldRange can be specified for “a” if the primary key supplied is empty. A FieldRange can be specified for “b” if the primary key supplied to the operation has a concrete value for “a” but not for “b” or “c”.

This object is used to scope a NoSQLHandle.multi_delete() operation. The field_path specified must name a field in a table’s primary key. The values used must be of the same type and that type must match the type of the field specified.

Validation of this object is performed when is it used in an operation. Validation includes verifying that the field is in the required key and, in the case of a composite key, that the field is in the proper order relative to the key used in the operation.

Parameters:field_path (str) – the path to the field used in the range.
Raises:IllegalArgumentException – raises the exception if field_path is not a string.

Methods Summary

get_end() Returns the field value that defines upper bound of the range, or None if no upper bound is enforced.
get_end_inclusive() Returns whether end is included in the range, i.e., end is greater than or equal to the last field value in the range.
get_field_path() Returns the name for the field used in the range.
get_start() Returns the field value that defines lower bound of the range, or None if no lower bound is enforced.
get_start_inclusive() Returns whether start is included in the range, i.e., start is less than or equal to the first field value in the range.
set_end(value, is_inclusive) Sets the end value of the range to the specified value.
set_start(value, is_inclusive) Sets the start value of the range to the specified value.

Methods Documentation

get_end()[source]

Returns the field value that defines upper bound of the range, or None if no upper bound is enforced.

Returns:the end field value.
get_end_inclusive()[source]

Returns whether end is included in the range, i.e., end is greater than or equal to the last field value in the range. This value is valid only if the end value is not None.

Returns:True if the end value is inclusive.
Return type:bool
get_field_path()[source]

Returns the name for the field used in the range.

Returns:the name of the field.
Return type:str
get_start()[source]

Returns the field value that defines lower bound of the range, or None if no lower bound is enforced.

Returns:the start field value.
get_start_inclusive()[source]

Returns whether start is included in the range, i.e., start is less than or equal to the first field value in the range. This value is valid only if the start value is not None.

Returns:True if the start value is inclusive.
Return type:bool
set_end(value, is_inclusive)[source]

Sets the end value of the range to the specified value.

Parameters:
  • value (any) – the value to set.
  • is_inclusive (bool) – set to True if the range is inclusive of the value, False if it is exclusive.
Returns:

self.

Raises:

IllegalArgumentException – raises the exception if parameters are not expected type.

set_start(value, is_inclusive)[source]

Sets the start value of the range to the specified value.

Parameters:
  • value (any) – the value to set.
  • is_inclusive (bool) – set to True if the range is inclusive of the value, False if it is exclusive.
Returns:

self.

Raises:

IllegalArgumentException – raises the exception if parameters are not expected type.