我打算将数据插入到具有复合键的CF下面.
CREATE TABLE event_attend (
event_id int,
event_type varchar,
event_user_id int,
PRIMARY KEY (event_id, event_type) #compound keys...
);
Run Code Online (Sandbox Code Playgroud)
但是我无法使用cql从python向此CF插入数据.(http://code.google.com/a/apache-extras.org/p/cassandra-dbapi2/)
import cql
connection = cql.connect(host, port, keyspace)
cursor = connection.cursor()
cursor.execute("INSERT INTO event_attend (event_id, event_type, event_user_id) VALUES (1, 'test', 2)", dict({}) )
Run Code Online (Sandbox Code Playgroud)
我得到以下回溯:
Traceback (most recent call last):
File "./v2_initial.py", line 153, in <module>
db2cass.execute()
File "./v2_initial.py", line 134, in execute
cscursor.execute("insert into event_attend (event_id, event_type, event_user_id ) values (1, 'test', 2)", dict({}))
File "/usr/local/pythonbrew/pythons/Python-2.7.2/lib/python2.7/site-packages/cql-1.4.0-py2.7.egg/cql/cursor.py", line 80, in execute
response = …Run Code Online (Sandbox Code Playgroud)