Question

Explanation with an example:

import cql
cql connect to CF/Keyspace
last_key = XYZ (say it's getting fetched from else where)
cursor.execute(select * from domain_dimension where key=:key", key="last_key")

The CQL documentation says it can be done, but on console it says execute() got unexpected keyword argument.

Does Cassandra CQL really support query substitution?

Was it helpful?

Solution

It looks like you need to pass the substitutions in a dict as a single arg, not as keyword args.

cursor.execute("select * from domain_dimension where key=:key", {'key': last_key})

That is how it specified in the example on the project homepage: http://code.google.com/a/apache-extras.org/p/cassandra-dbapi2/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top