2

i am using Python Cassandra driver and CQL on back end, i want to update the data with IN operator

a = [1,2,3,4]
I want to run the following query
query = session.execute("update users set status=True where userid IN(%s)",[a])

but it does not work, i want to update the record where userid in list

Can any body help me please?

2 Answers 2

7

Try this:

from cassandra import query

yourquery = session.execute("update users set status=True where userid IN %s", query.ValueSequence([a]));
Sign up to request clarification or add additional context in comments.

Comments

0

Try This :

dateList = ('2019-03-01', '2019-03-02')

cid_prep_statement = session.prepare('SELECT cid from table_name where "entry_date" **IN ?** and "language_name"=? LIMIT 10')

cassandra_cids = session.execute(cid_prep_statement, (**ValueSequence(dateList)**,'English'))

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.