TableResult

class borneo.TableResult[source]

Bases: borneo.operations.Result

TableResult is returned from NoSQLHandle.get_table() and NoSQLHandle.table_request() operations. It encapsulates the state of the table that is the target of the request.

Operations available in NoSQLHandle.table_request() such as table creation, modification, and drop are asynchronous operations. When such an operation has been performed, it is necessary to call NoSQLHandle.get_table() until the status of the table is State.ACTIVE, State.DROPPED or there is an error condition. The method wait_for_completion() exists to perform this task and should be used to wait for an operation to complete.

NoSQLHandle.get_table() is synchronous, returning static information about the table as well as its current state.

Methods Summary

get_operation_id() Returns the operation id for an asynchronous operation.
get_schema() Returns the schema for the table.
get_state() Returns the table state.
get_table_limits() Returns the throughput and capacity limits for the table.
get_table_name() Returns the table name of the target table.
wait_for_completion(handle, wait_millis, …) Waits for a table operation to complete.

Methods Documentation

get_operation_id()[source]

Returns the operation id for an asynchronous operation. This is none if the request did not generate a new operation. The value can be used in set_operation_id() to find potential errors resulting from the operation.

Returns:the operation id for an asynchronous operation.
Return type:str
get_schema()[source]

Returns the schema for the table.

Returns:the schema for the table.
Return type:str
get_state()[source]

Returns the table state. A table in state State.ACTIVE or State.UPDATING is usable for normal operation.

Returns:the state.
Return type:State
get_table_limits()[source]

Returns the throughput and capacity limits for the table. Limits from an on-premise service will always be None.

Returns:the limits.
Return type:TableLimits
get_table_name()[source]

Returns the table name of the target table.

Returns:the table name.
Return type:str
wait_for_completion(handle, wait_millis, delay_millis)[source]

Waits for a table operation to complete. Table operations are asynchronous. This is a blocking, polling style wait that delays for the specified number of milliseconds between each polling operation. This call returns when the table reaches a terminal state, which is either State.ACTIVE or State.DROPPED.

This instance must be the return value of a previous NoSQLHandle.table_request() and contain a non-none operation id representing the in-progress operation unless the operation has already completed.

This instance is modified with any change in table state or metadata.

Parameters:
  • handle (NoSQLHandle) – the NoSQLHandle to use.
  • wait_millis (int) – the total amount of time to wait, in milliseconds. This value must be non-zero and greater than delay_millis.
  • delay_millis (int) – the amount of time to wait between polling attempts, in milliseconds. If 0 it will default to 500.
Raises: