Sets a global consistency level and client-supplied timestamp for all columns written by the statements in the batch.
BEGIN BATCH
[ USING <write_option> [ AND <write_option> [...] ] ];
<dml_statement>
<dml_statement>
[...]
APPLY BATCH;
<write_option> is:
USING CONSISTENCY <consistency_level>
TIMESTAMP <integer>
A BATCH statement combines multiple data modification (DML) statements into a single logical operation. BATCH supports setting a client-supplied, global consistency level and timestamp that is used for each of the operations included in the batch.
You can specify these global options in the USING clause:
Batched statements default to a consistency level of ONE when unspecified.
After the USING clause, you can add only these DML statements:
Individual DML statements inside a BATCH cannot specify a consistency level or timestamp. These individual statements can specify a TTL (time to live). TTL columns are automatically marked as deleted (with a tombstone) after the requested amount of time has expired.
Close the batch statement with APPLY BATCH.
BATCH is not an analogue for SQL ACID transactions. Column updates are considered atomic within a given record (row) only.
BEGIN BATCH USING CONSISTENCY QUORUM
INSERT INTO users (KEY, password, name) VALUES ('user2', 'ch@ngem3b', 'second user')
UPDATE users SET password = 'ps22dhds' WHERE KEY = 'user2'
INSERT INTO users (KEY, password) VALUES ('user3', 'ch@ngem3c')
DELETE name FROM users WHERE key = 'user2'
INSERT INTO users (KEY, password, name) VALUES ('user4', 'ch@ngem3c', 'Andrew')
APPLY BATCH;