I have a task that insert data into a cassandra table, but i donnot want to overwrite the records that have been inserted before, but the insert cql would overwrite existing data.
Fortunately, I find a operation of 'USING TIMESTAMP ', cql with larger timestamp will overwrite the smaller one, otherwise not. So with 'USING TIMESTAMP' i could use a custom timestamp to determine whether overwrite or not. It works fine in Cqlsh.
But it fails in python-cassandra-driver, how to make 'USING TIMESTAMP' work in python-cassandra-driver? My code is as follow:
insert_sql = ("INSERT INTO activate (rowkey, qualifier, info, act_date, log_time) "
"VALUES(%s, %s, %s, %s, %s) "
"USING TIMESTAMP %s")
insert_data = (a_string, a_string, a_string, a_string, a_string, a_custom_timestamp)
session.execute(insert_sql, insert_data)