문제

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?

도움이 되었습니까?

해결책

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/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top