I want to generate a DELETE statement with Cequel:
DELETE FROM users where pk = 'jsmith' and cc < 100;
Let's say my user model looks like this
class Users
include Cequel::Record
key :pk, :bigint, { partition: true } # partition key
key :cc, :timestamp, { order: :desc } # clustering column
end
Right now, I am iterating through the rows using a simple where clause and destroy them one by one, I know this is not the right way to do it, but I can't find a way to generate the correct statement to delete them all at once.
How can I use my Users model to generate the above CQL statement.
EDIT: also posted here
About the
smaller-thanpart, it is not allowed to use it on a primary key part in aDELETEstatement.The
delete_allmethod does create aDELETEstatement.here is how to use it:
As I have more clustering columns after the
ccone, iterating through theccs gives me a more effective solution than iterating through each of the other clustering columns under cc.Some more explanations on github: https://github.com/cequel/cequel/issues/237