vendredi 24 octobre 2014

cql query where timestamp is 15+ days ago in Cassandra


Vote count:

0




I am new to Cassandra and cql. I wanted to do cql query same with the following sql.



where datetime < DATE_SUB(DATE(now()), INTERVAL 15 DAY) order by datetime ASC


So, I did like following with DataStax Python Driver for Apache Cassandra, but it didn't work.



prepared_stmt = session.prepare ( "SELECT * FROM repos WHERE updated_at < DATE_SUB(DATE(now()), INTERVAL ? DAY) order by datetime ASC")
bound_stmt = prepared_stmt.bind([15])
stmt = session.execute(bound_stmt)


and I got the error message



SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 1:70 no viable alternative at input '?'">


updated_at is datetime format I added before running this code snippet. What was I wrong?


p.s. Also, if you know some good material for understanding datetime job in Cassandra, please let me know.



asked 11 mins ago







cql query where timestamp is 15+ days ago in Cassandra

Aucun commentaire:

Enregistrer un commentaire