cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul van Hoven <>
Subject Perfroming simple CQL Query using pyhton db-api 2.0 fails
Date Wed, 23 Jan 2013 18:14:42 GMT
I try to access my local cassandra database via python. Therefore I
installed db-api 2.0 and thrift for accessing the database. Opening
and closing a connection works fine. But a simply query is not

The script looks like this:

    c = conn.cursor()
    c.execute("""select * from users;""")
    data = c.fetchall()
    print "Query: select * from users; returned the following result:"
    print str(data)

The table users looks like this:
qlsh:demodb> select * from users;

 user_name | birth_year | gender | password | session_token | state
    jsmith |       null |   null |   secret |          null |  null

But when I try to execute it I get the following error:
Open connection to localhost:9160 on keyspace demodb
Traceback (most recent call last):
  File "/Users/Tom/Freelancing/Company/Python/ApacheCassandra/src/",
line 56, in <module>
  File "/Users/Tom/Freelancing/Company/Python/ApacheCassandra/src/",
line 46, in perfromSimpleCQLQuery
    c.execute("""select * from users;""")
  File "/Library/Python/2.7/site-packages/cql/", line 81, in execute
    return self.process_execution_results(response, decoder=decoder)
  File "/Library/Python/2.7/site-packages/cql/", line
116, in process_execution_results
  File "/Library/Python/2.7/site-packages/cql/", line 97, in
    name, nbytes, vtype, ctype = self.get_column_metadata(colid)
  File "/Library/Python/2.7/site-packages/cql/", line 104, in
    return self.decoder.decode_metadata_and_type(column_id)
  File "/Library/Python/2.7/site-packages/cql/", line 45,
in decode_metadata_and_type
    name = self.name_decode_error(e, namebytes,
  File "/Library/Python/2.7/site-packages/cql/", line 29,
in name_decode_error
    % (namebytes, expectedtype, err))
cql.apivalues.ProgrammingError: column name '\x00\x00\x00' can't be
deserialized as 'org.apache.cassandra.db.marshal.CompositeType':
global name 'self' is not defined

I'm not shure if this is the right place to ask for: But am I doing
here something wrong?

View raw message