Partition

class PartitionService(internal_partition_service, serialization_service, send_schema_and_retry_fn)[source]

Bases: object

Allows retrieving information about the partition count, the partition owner or the partition id of a key.

get_partition_owner(partition_id: int) Optional[uuid.UUID][source]

Returns the owner of the partition if it’s set, None otherwise.

Parameters

partition_id – The partition id.

Returns

Owner of the partition

get_partition_id(key: Any) int[source]

Returns the partition id for a key data.

Parameters

key – The given key.

Returns

The partition id.

get_partition_count() int[source]

Returns partition count of the connected cluster.

If partition table is not fetched yet, this method returns 0.

Returns

The partition count