How does one do an atomic update in a column family with a single column?
I have a this CF
CREATE TABLE schema_migrations (
version TEXT PRIMARY KEY,
) WITH COMPACTION = {'class': 'LeveledCompactionStrategy'};
that records which database migrations have been applied. I want to do
a CAS UPDATE to add a dummy lock token to prevent multiple migrations
from running, but these three attempts fail (using the Python cql client):
>>> cursor.execute("UPDATE schema_migrations SET version = 'locked'
WHERE version = 'locked' IF NOT EXISTS")
cql.apivalues.ProgrammingError: Bad Request: PRIMARY KEY part version
found in SET part
>>> cursor.execute("UPDATE schema_migrations SET WHERE version =
'locked' IF NOT EXISTS")
cql.apivalues.ProgrammingError: Bad Request: line 1:29 no viable
alternative at input 'WHERE'
>>> cursor.execute("INSERT INTO schema_migrations (version) VALUES
('locked') IF NOT EXISTS")
cql.apivalues.ProgrammingError: Bad Request: line 1:58 missing EOF at 'IF'
Thanks,
Blair