Amazon DynamoDB

Amazon DynamoDB Task states.

class rhodes.states.services.dynamodb.AmazonDynamoDb(*, TableName=None)[source]

Bases: object

Helper to provide easy access to integration helpers.

Parameters:TableName – The table to interact with
get_item(title, **kwargs)[source]

Return a set of attributes for the item with the given primary key.

TableName as well as any provided kwargs are passed to the AmazonDynamoDbGetItem constructor.

Return type:AmazonDynamoDbGetItem
put_item(title, **kwargs)[source]

Create a new item or replace an old item with a new item.

TableName as well as any provided kwargs are passed to the AmazonDynamoDbPutItem constructor.

Return type:AmazonDynamoDbPutItem
delete_item(title, **kwargs)[source]

Delete a single item in a table by primary key.

TableName as well as any provided kwargs are passed to the AmazonDynamoDbDeleteItem constructor.

Return type:AmazonDynamoDbDeleteItem
update_item(title, **kwargs)[source]

Edit an existing item’s attributes or add a new item to the table if it does not already exist.

TableName as well as any provided kwargs are passed to the AmazonDynamoDbUpdateItem constructor.

Return type:AmazonDynamoDbUpdateItem
class rhodes.states.services.dynamodb.AmazonDynamoDbGetItem(title, *, Comment=None, AttributesToGet=None, ConsistentRead=None, ExpressionAttributeNames=None, ProjectionExpression=None, ReturnConsumedCapacity=None, Next=None, End=None, InputPath=JsonPath(path=Root()), OutputPath=JsonPath(path=Root()), ResultPath=JsonPath(path=Root()), Retry=None, Catch=None, TimeoutSeconds=None, HeartbeatSeconds=None, Pattern=<IntegrationPattern.REQUEST_RESPONSE: ''>, TableName=None, Key=None)[source]

Bases: rhodes.states.State

Return a set of attributes for the item with the given primary key.

See service docs for more details.

Parameters:
  • AttributesToGet – This is a legacy parameter. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.
  • ConsistentRead – Determines the read consistency model
  • ExpressionAttributeNames – One or more substitution tokens for attribute names in an expression.
  • ProjectionExpression – A string that identifies one or more attributes to retrieve from the table.
  • ReturnConsumedCapacity – Determines the level of detail about provisioned throughput consumption that is returned in the response
  • title (str) – Name of state in state machine
  • Comment (str) – Human-readable description of the state (default: '')
  • Next – The state that will follow this state
  • End (bool) – This state is a terminal state
  • InputPath (JsonPath) – The portion of the state input data to be used as input for the state (default: JsonPath(path=Root()))
  • OutputPath (JsonPath) – The portion of the state input data to be passed to the next state (default: JsonPath(path=Root()))
  • ResultPath (JsonPath) – Where in the state input data to place the results of this state (default: JsonPath(path=Root()))
  • Retry
  • Catch
  • TimeoutSeconds (int) – Maximum time that this state is allowed to run
  • HeartbeatSeconds (int) – Maximum time allowed between heartbeat responses from state
  • Pattern (IntegrationPattern) – Step Functions integration pattern (default: <IntegrationPattern.REQUEST_RESPONSE: ''>)
  • TableName – The table to interact with
  • Key – A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.
end()

Make this state a terminal state.

member_of = None
promote(path)

Add a Pass state after this state that promotes a path in the input to this state’s ResultPath.

Path must start with a path relative this state’s ResultPath as indicated by a @. prefix.

Parameters:path (Union[str, Enum, JSONPath, JsonPath]) – Path to promote
Return type:Pass
then(next_state)

Set the next state in this state machine.

to_dict() → Dict[KT, VT]

Serialize state as a dictionary.

Return type:Dict
class rhodes.states.services.dynamodb.AmazonDynamoDbPutItem(title, *, Comment=None, Item=None, Next=None, End=None, InputPath=JsonPath(path=Root()), OutputPath=JsonPath(path=Root()), ResultPath=JsonPath(path=Root()), Retry=None, Catch=None, TimeoutSeconds=None, HeartbeatSeconds=None, Pattern=<IntegrationPattern.REQUEST_RESPONSE: ''>, TableName=None, ConditionalOperator=None, ConditionExpression=None, Expected=None, ExpressionAttributeNames=None, ExpressionAttributeValues=None, ReturnConsumedCapacity=None, ReturnItemCollectionMetrics=None, ReturnValues=None)[source]

Bases: rhodes.states.State

Create a new item or replace an old item with a new item.

See service docs for more details.

Parameters:
  • Item – A map of attribute name/value pairs, one for each attribute.
  • title (str) – Name of state in state machine
  • Comment (str) – Human-readable description of the state (default: '')
  • Next – The state that will follow this state
  • End (bool) – This state is a terminal state
  • InputPath (JsonPath) – The portion of the state input data to be used as input for the state (default: JsonPath(path=Root()))
  • OutputPath (JsonPath) – The portion of the state input data to be passed to the next state (default: JsonPath(path=Root()))
  • ResultPath (JsonPath) – Where in the state input data to place the results of this state (default: JsonPath(path=Root()))
  • Retry
  • Catch
  • TimeoutSeconds (int) – Maximum time that this state is allowed to run
  • HeartbeatSeconds (int) – Maximum time allowed between heartbeat responses from state
  • Pattern (IntegrationPattern) – Step Functions integration pattern (default: <IntegrationPattern.REQUEST_RESPONSE: ''>)
  • TableName – The table to interact with
  • ConditionalOperator – This is a legacy parameter. Use ConditionExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.
  • ConditionExpression – A condition that must be satisfied in order for a conditional operation to succeed.
  • Expected – This is a legacy parameter. Use ConditionExpression instead. For more information, see Expected in the Amazon DynamoDB Developer Guide.
  • ExpressionAttributeNames – One or more substitution tokens for attribute names in an expression.
  • ExpressionAttributeValues – One or more values that can be substituted in an expression.
  • ReturnConsumedCapacity – Determines the level of detail about provisioned throughput consumption that is returned in the response
  • ReturnItemCollectionMetrics – Determines whether item collection metrics are returned.
  • ReturnValues – Use ReturnValues if you want to get the item attributes as they appeared before they were updated with the request.
end()

Make this state a terminal state.

member_of = None
promote(path)

Add a Pass state after this state that promotes a path in the input to this state’s ResultPath.

Path must start with a path relative this state’s ResultPath as indicated by a @. prefix.

Parameters:path (Union[str, Enum, JSONPath, JsonPath]) – Path to promote
Return type:Pass
then(next_state)

Set the next state in this state machine.

to_dict() → Dict[KT, VT]

Serialize state as a dictionary.

Return type:Dict
class rhodes.states.services.dynamodb.AmazonDynamoDbDeleteItem(title, *, Comment=None, Next=None, End=None, InputPath=JsonPath(path=Root()), OutputPath=JsonPath(path=Root()), ResultPath=JsonPath(path=Root()), Retry=None, Catch=None, TimeoutSeconds=None, HeartbeatSeconds=None, Pattern=<IntegrationPattern.REQUEST_RESPONSE: ''>, TableName=None, Key=None, ConditionalOperator=None, ConditionExpression=None, Expected=None, ExpressionAttributeNames=None, ExpressionAttributeValues=None, ReturnConsumedCapacity=None, ReturnItemCollectionMetrics=None, ReturnValues=None)[source]

Bases: rhodes.states.State

Delete a single item in a table by primary key.

See service docs for more details.

Parameters:
  • title (str) – Name of state in state machine
  • Comment (str) – Human-readable description of the state (default: '')
  • Next – The state that will follow this state
  • End (bool) – This state is a terminal state
  • InputPath (JsonPath) – The portion of the state input data to be used as input for the state (default: JsonPath(path=Root()))
  • OutputPath (JsonPath) – The portion of the state input data to be passed to the next state (default: JsonPath(path=Root()))
  • ResultPath (JsonPath) – Where in the state input data to place the results of this state (default: JsonPath(path=Root()))
  • Retry
  • Catch
  • TimeoutSeconds (int) – Maximum time that this state is allowed to run
  • HeartbeatSeconds (int) – Maximum time allowed between heartbeat responses from state
  • Pattern (IntegrationPattern) – Step Functions integration pattern (default: <IntegrationPattern.REQUEST_RESPONSE: ''>)
  • TableName – The table to interact with
  • Key – A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.
  • ConditionalOperator – This is a legacy parameter. Use ConditionExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.
  • ConditionExpression – A condition that must be satisfied in order for a conditional operation to succeed.
  • Expected – This is a legacy parameter. Use ConditionExpression instead. For more information, see Expected in the Amazon DynamoDB Developer Guide.
  • ExpressionAttributeNames – One or more substitution tokens for attribute names in an expression.
  • ExpressionAttributeValues – One or more values that can be substituted in an expression.
  • ReturnConsumedCapacity – Determines the level of detail about provisioned throughput consumption that is returned in the response
  • ReturnItemCollectionMetrics – Determines whether item collection metrics are returned.
  • ReturnValues – Use ReturnValues if you want to get the item attributes as they appeared before they were updated with the request.
end()

Make this state a terminal state.

member_of = None
promote(path)

Add a Pass state after this state that promotes a path in the input to this state’s ResultPath.

Path must start with a path relative this state’s ResultPath as indicated by a @. prefix.

Parameters:path (Union[str, Enum, JSONPath, JsonPath]) – Path to promote
Return type:Pass
then(next_state)

Set the next state in this state machine.

to_dict() → Dict[KT, VT]

Serialize state as a dictionary.

Return type:Dict
class rhodes.states.services.dynamodb.AmazonDynamoDbUpdateItem(title, *, Comment=None, AttributeUpdates=None, UpdateExpression=None, Next=None, End=None, InputPath=JsonPath(path=Root()), OutputPath=JsonPath(path=Root()), ResultPath=JsonPath(path=Root()), Retry=None, Catch=None, TimeoutSeconds=None, HeartbeatSeconds=None, Pattern=<IntegrationPattern.REQUEST_RESPONSE: ''>, TableName=None, Key=None, ConditionalOperator=None, ConditionExpression=None, Expected=None, ExpressionAttributeNames=None, ExpressionAttributeValues=None, ReturnConsumedCapacity=None, ReturnItemCollectionMetrics=None, ReturnValues=None)[source]

Bases: rhodes.states.State

Edit an existing item’s attributes or add a new item to the table if it does not already exist.

See service docs for more details.

Parameters:
  • AttributeUpdates – This is a legacy parameter. Use UpdateExpression instead. For more information, see AttributeUpdates in the Amazon DynamoDB Developer Guide.
  • UpdateExpression – An expression that defines one or more attributes to be updated, the action to be performed on them, and new values for them.
  • title (str) – Name of state in state machine
  • Comment (str) – Human-readable description of the state (default: '')
  • Next – The state that will follow this state
  • End (bool) – This state is a terminal state
  • InputPath (JsonPath) – The portion of the state input data to be used as input for the state (default: JsonPath(path=Root()))
  • OutputPath (JsonPath) – The portion of the state input data to be passed to the next state (default: JsonPath(path=Root()))
  • ResultPath (JsonPath) – Where in the state input data to place the results of this state (default: JsonPath(path=Root()))
  • Retry
  • Catch
  • TimeoutSeconds (int) – Maximum time that this state is allowed to run
  • HeartbeatSeconds (int) – Maximum time allowed between heartbeat responses from state
  • Pattern (IntegrationPattern) – Step Functions integration pattern (default: <IntegrationPattern.REQUEST_RESPONSE: ''>)
  • TableName – The table to interact with
  • Key – A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.
  • ConditionalOperator – This is a legacy parameter. Use ConditionExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.
  • ConditionExpression – A condition that must be satisfied in order for a conditional operation to succeed.
  • Expected – This is a legacy parameter. Use ConditionExpression instead. For more information, see Expected in the Amazon DynamoDB Developer Guide.
  • ExpressionAttributeNames – One or more substitution tokens for attribute names in an expression.
  • ExpressionAttributeValues – One or more values that can be substituted in an expression.
  • ReturnConsumedCapacity – Determines the level of detail about provisioned throughput consumption that is returned in the response
  • ReturnItemCollectionMetrics – Determines whether item collection metrics are returned.
  • ReturnValues – Use ReturnValues if you want to get the item attributes as they appeared before they were updated with the request.
end()

Make this state a terminal state.

member_of = None
promote(path)

Add a Pass state after this state that promotes a path in the input to this state’s ResultPath.

Path must start with a path relative this state’s ResultPath as indicated by a @. prefix.

Parameters:path (Union[str, Enum, JSONPath, JsonPath]) – Path to promote
Return type:Pass
then(next_state)

Set the next state in this state machine.

to_dict() → Dict[KT, VT]

Serialize state as a dictionary.

Return type:Dict