TableLimits

class borneo.TableLimits(read_units, write_units, storage_gb, mode=1)[source]

Bases: object

Cloud service only.

A TableLimits instance is used during table creation to specify the throughput and capacity to be consumed by the table. It is also used in an operation to change the limits of an existing table. NoSQLHandle.table_request() and TableRequest are used to perform these operations. These values are enforced by the system and used for billing purposes.

Throughput limits are defined in terms of read units and write units. A read unit represents 1 eventually consistent read per second for data up to 1 KB in size. A read that is absolutely consistent is double that, consuming 2 read units for a read of up to 1 KB in size. This means that if an application is to use Consistency.ABSOLUTE it may need to specify additional read units when creating a table. A write unit represents 1 write per second of data up to 1 KB in size.

In addition to throughput table capacity must be specified to indicate the maximum amount of storage, in gigabytes, allowed for the table.

In provisioned mode, all 3 values must be used whenever using this object. There are no defaults and no mechanism to indicate “no change.”

In on demand mode, only the storage_gb parameter must be set.

Parameters:
  • read_units (int) – the desired throughput of read operation in terms of read units. A read unit represents 1 eventually consistent read per second for data up to 1 KB in size. A read that is absolutely consistent is double that, consuming 2 read units for a read of up to 1 KB in size.
  • write_units (int) – the desired throughput of write operation in terms of write units. A write unit represents 1 write per second of data up to 1 KB in size.
  • storage_gb (int) – the maximum storage to be consumed by the table, in gigabytes.
  • mode (CAPACITY_MODE) – the mode of the table: provisioned (the default) or on demand.
Raises:

IllegalArgumentException – raises the exception if parameters are not valid.

Versionchanged:

5.3.0, added optional CAPACITY_MODE

Methods Summary

get_mode() Returns the capacity mode of the table.
get_read_units() Returns the read throughput in terms of read units.
get_storage_gb() Returns the storage capacity in gigabytes.
get_write_units() Returns the write throughput in terms of write units.
set_mode(mode) Sets the mode of the table:
set_read_units(read_units) Sets the read throughput in terms of read units.
set_storage_gb(storage_gb) Sets the storage capacity in gigabytes.
set_write_units(write_units) Sets the write throughput in terms of write units.

Methods Documentation

__init__(read_units, write_units, storage_gb, mode=1)[source]

Creates a TableLimits object

Parameters:
  • read_units (int) – the desired throughput of read operation in terms of read units. A read unit represents 1 eventually consistent read per second for data up to 1 KB in size. A read that is absolutely consistent is double that, consuming 2 read units for a read of up to 1 KB in size.
  • write_units (int) – the desired throughput of write operation in terms of write units. A write unit represents 1 write per second of data up to 1 KB in size.
  • storage_gb (int) – the maximum storage to be consumed by the table, in gigabytes.
  • mode (CAPACITY_MODE) – the mode of the table: provisioned (the default) or on demand.
Raises:

IllegalArgumentException – raises the exception if parameters are not valid.

Versionchanged:

5.3.0, added optional CAPACITY_MODE

get_mode()[source]

Returns the capacity mode of the table.

Returns:mode: PROVISIONED or ON_DEMAND
Versionadded:5.3.0
get_read_units()[source]

Returns the read throughput in terms of read units.

Returns:the read units.
Return type:int
get_storage_gb()[source]

Returns the storage capacity in gigabytes.

Returns:the storage capacity in gigabytes.
Return type:int
get_write_units()[source]

Returns the write throughput in terms of write units.

Returns:the write units.
Return type:int
set_mode(mode)[source]
Sets the mode of the table:
PROVISIONED: Fixed maximum read/write units. This is the default. ON_DEMAND: Flexible read/write limits.
Parameters:mode (TableLimits.CAPACITY_MODE) – the capacity to use, in gigabytes.
Returns:self.
Raises:IllegalArgumentException – raises the exception if mode is invalid.
Versionadded:5.3.0
set_read_units(read_units)[source]

Sets the read throughput in terms of read units.

Parameters:read_units (int) – the throughput to use, in read units.
Returns:self.
Raises:IllegalArgumentException – raises the exception if read_units is not a integer.
set_storage_gb(storage_gb)[source]

Sets the storage capacity in gigabytes.

Parameters:storage_gb (int) – the capacity to use, in gigabytes.
Returns:self.
Raises:IllegalArgumentException – raises the exception if storage_gb is not a integer.
set_write_units(write_units)[source]

Sets the write throughput in terms of write units.

Parameters:write_units (int) – the throughput to use, in write units.
Returns:self.
Raises:IllegalArgumentException – raises the exception if write_units is not a integer.