INSERT INTO users (login, email, name, login_time)
VALUES ('jdoe', 'jd...@abc.com', 'Jane Doe', )
IF NOT EXISTThanks,Li
You can always declare a unique index on any fields you like, then do
insert ... on duplicate key ignore
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.
Not sure how relevant this information is to your particular situation but it might help so I thought I'd share. If you are inserting a new record for a duplicate primary key Cassandra does not enforce unique-ness. Inserting a duplicate row key will upsert the columns contained in the insert statement rather than return a unique constraint violation.Because of this we don't even bother with the "IF NOT EXISTS" in our inserts.
On Thursday, November 7, 2013 7:11:15 PM UTC-7, Li Wang wrote:Hi,I need to do a conditional insert. Is "IF NOT EXIST" the only condition we can check for the INSERT statement, or can we do something more powerful?All the samples I have seen for INSERT use the "IF NOT EXIST" condition.INSERT INTO users (login, email, name, login_time) VALUES ('jdoe', 'jd...@abc.com', 'Jane Doe', ) IF NOT EXISTThanks,Li
To unsubscribe from this group and stop receiving emails from it, send an email to java-driver-us...@lists.datastax.com.