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?

Était-ce utile?

La 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/

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top