Dynamoid / dynamoid

Ruby ORM for Amazon's DynamoDB.
MIT License
573 stars 197 forks source link

Why do I call Dynamoid::TransactionWrite and get an error name uninitialized constant? #763

Open namdv-1375 opened 1 month ago

namdv-1375 commented 1 month ago
[1] pry(main)> Dynamoid::TransactionWrite 
NameError: uninitialized constant Dynamoid::TransactionWrite
from (pry):1:in `__pry__'

Why do I call Dynamoid::TransactionWrite and get an error name uninitialized constant? Please help me, thankssss <3

ckhsponge commented 1 month ago

I thought I remembered the first version of TransactionWrite being released in 3.10 but I don't see it there. It's in main so you can put this in your gemfile: gem 'dynamoid', git: 'https://github.com/Dynamoid/dynamoid.git'

This branch has some more documentation about some hidden features but won't be live until the non-transaction actions catch up: gem 'dynamoid', git: 'https://github.com/ckhsponge/dynamoid.git', branch: 'transact-update'

@andrykonchin Want to release transactions some time?

namdv-1375 commented 1 month ago

gem 'dynamoid', git: 'https://github.com/Dynamoid/dynamoid.git' -> works for me Thanksssss <3

namdv-1375 commented 1 month ago

@ckhsponge Let me ask, if I want to delete_all with Dynamoid::TransactionWrite, is there any way?

ckhsponge commented 1 month ago

No. I believe in DynamoDB deletions can only occur individually, in a batch or in a transaction and always require primary keys. Dynamoid's delete_all probably gets keys and deletes in batches and this wouldn't be possible in a transaction.

andrykonchin commented 1 month ago

@ckhsponge Yeah, the next version with transactions support should be released soon. I have some ideas how to polish new tests and wanted to close some minor issues.