I don't believe it's currently possible to use the Mapper API to execute CQL that's using LWT. The Insert, Update, Delete, and Execute methods all return void (or Task in the case of the async versions) so there's no current way to retrieve the [applied] column that would come back, or the current values that would be returned in the case where [applied] is false.
What should the API look like?
Can we reuse an existing method and just add an overload with a return value or do we need to create a specific method?
If we do create specific methods, do we need to be able to generate appropriate CQL for LWT?
The LINQ driver looks like it supports adding IF or IF NOT EXISTS to generated CQL, but the Execute methods don't return anything where you can check the result. Is this accurate? Should we fix them?
Hi, I'm currently trying to use the ExecuteConditional method but I'm having a problem with getting the rows that failed.
Apparently the ExecuteConditional only returns one of the objects that failed to be inserted, but what if there where more than one?
In my case I need to get all the rows that failed to be inserted.
I tried this but it doesn't work:
Thanks for your time
Cassandra only yields the first condition that failed in a batch result so there is no way to get that information at driver level.
You should check if that information is enough for you or if changes in the data model or data access solve the issue. If you have any doubt or need any help, don't hesitate to post it in the project mailing list: https://groups.google.com/a/lists.datastax.com/forum/#!forum/csharp-driver-user
I have this implemented without using the mappings and it is returning all the rows that failed.
In that implementation I'm creating a BatchStatement, and then I add several BoundStatements to it and execute the batch with session.Execute(batch). The result RowSet object I get from that execution has a RowQueue property that contains a collection of Cassandra.Row objects that represent the rows that failed.
Shouldn't it be possible to do the same with the ExecuteConditional and the AppliedInfo?
Ohh... sorry, you are right: I just created a ticket for it CSHARP-334.
Thanks for insisting!