Insertion error

48 views
Skip to first unread message

Paul Westin

unread,
Apr 12, 2013, 11:42:21 AM4/12/13
to pycassa...@googlegroups.com
I've been converting a few scripts from CQL to Pycassa, and have hit a brick wall when it comes to inserting rows.

I first tried inserting with an IntegerType comparator, and now a UUIDType, and I can't seem to get either to work.

Versions:
    Python 2.7.3
    Cassandra 1.2.3-SNAPSHOT
    >>> pycassa.__version__
    '1.8.0'

This is a minimal example of trying to insert a new UUID row:

https://gist.github.com/pilate/2b0b8751bbcf1563c913

Passing a UUID as the key name gives me the error:

    A str or unicode value was expected, but UUID was received instead (5c91fb8c-7392-416a-a698-7e96a39bffa2)

If I wrap that UUID in a str() call, it tells me:

    Argument for a v1 UUID column name or value was neither a UUID, a datetime, or a number


Changing it to IntegerType, and trying to pass int()'s gives me something similar:

    unsupported operand type(s) for &: 'int' and 'str'


I feel like I have to be doing something extremely wrong here; Any suggestions?



Tyler Hobbs

unread,
Apr 12, 2013, 11:48:12 AM4/12/13
to pycassa...@googlegroups.com
The comparator applies to column names.  I think you're looking for key_validation_class, which applies to row keys.






--
You received this message because you are subscribed to the Google Groups "pycassa-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pycassa-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Tyler Hobbs
DataStax

Paul Westin

unread,
Apr 12, 2013, 11:57:21 AM4/12/13
to pycassa...@googlegroups.com
That makes sense! I added that to the column family creation, and double checked before insertion by printing column_name_class and key_validation_class:

https://gist.github.com/pilate/2b0b8751bbcf1563c913

Output:

UUIDType UUIDType

Argument for a v1 UUID column name or value was neither a UUID, a datetime, or a number



Paul Westin

unread,
Apr 12, 2013, 12:02:26 PM4/12/13
to pycassa...@googlegroups.com
Arg, had to drop the column_name_class; Thanks a ton!
Reply all
Reply to author
Forward
0 new messages