Skip to content

DynamoDB State

State manager using dynamoDB

DynamoDBState

Bases: State

DynamoDBState: A state manager that stores state in DynamoDB.

Attributes:

Name Type Description
dynamodb boto3.resources.factory.dynamodb.ServiceResource

The DynamoDB service resource.

table boto3.resources.factory.dynamodb.Table

The DynamoDB table.

__init__(task_id, table_name, region_name)

Initialize a new DynamoDB state manager.

Parameters:

Name Type Description Default
task_id str

The task identifier.

required
table_name str

The name of the DynamoDB table.

required
region_name str

The name of the AWS region.

required

get(task_id, key)

Get the state associated with a task and key.

Parameters:

Name Type Description Default
task_id str

The task identifier.

required
key str

The key to get the state for.

required

Returns:

Type Description
Optional[Dict[str, Any]]

Optional[Dict[str, Any]]: The state associated with the task and key, if it exists.

set(task_id, key, value)

Set the state associated with a task and key.

Parameters:

Name Type Description Default
task_id str

The task identifier.

required
key str

The key to set the state for.

required
value Dict[str, Any]

The state to set.

required