Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Transactions with DynamoDB library Boto3

is there any way to do ACID transactions using Boto3 (Python library) ?

I want to write an item to multiple tables and make sure the write as been applied to all of the tables, otherwise roll-back. I read the Boto3 documentation and didn't see any mention of transaction or ACID operations.

I looked into this library : http://dynamodb-mapper.readthedocs.io/en/latest/

I've checked out the code, it seems to be using the old boto library and it doesn't seem to be supported anymore.

I know that there's an AWS solution for Transactions: https://aws.amazon.com/blogs/aws/dynamodb-transaction-library/

This is done using Java code. I was wondering if any of you we're able to perform transactions on DynamoDB using Boto3 ?

Thanks

like image 709
ElCapitaine Avatar asked Jan 16 '17 02:01

ElCapitaine


2 Answers

The boto3 library does not provide any support for cross-table transactions like that supported by the Java client library you reference. DynamoDB itself does not natively support this functionality so transactions like this have to be implemented at the client layer and your tables much be designed to support the fields required by the client software.

It would certainly be possible to implement a Python transaction client similar to the Java one but as far as I know, no one has.

like image 76
garnaat Avatar answered Sep 20 '22 18:09

garnaat


For people searching for transactions, this has now changed. AWS recently introduced DynamoDB Transactions. Boto will be updated to handle them.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transactions.html

like image 40
Fahad Alrashed Avatar answered Sep 16 '22 18:09

Fahad Alrashed