pycassa/pycassa — Issue #90: pycassa 1.2.1 cassandra 0.7.x,   sys.alter_column() fails: struct.error: cannot convert argument to integer
Author: matkor
Created: 2011-10-20 09:24:52+00:00
State: open

pycassa 1.2.1 cassandra 0.7.x,
code:
sys = pycassa.system_manager.SystemManager(TEST_SERVERS[0])
sys.create_keyspace('TestKeyspace', replication_factor=1)
sys.create_column_family('TestKeyspace', 'TestCF', super=False, comparator_type="org.apache.cassandra.db.marshal.LongType" )
# NOTE: super=False , comparator_type=pycassa.system_manager.LONG_TYPE seems not work
## sys.alter_column_family('TestKeyspace', 'TestCF', key_cache_size=42, gc_grace_seconds=1000)
keyspace_column_families = sys.get_keyspace_column_families('TestKeyspace', use_dict_for_col_metadata=True)
## print "keyspace_column_families: %r" % (keyspace_column_families, )
test_cf = keyspace_column_families['TestCF']
## print "test_cf: %r" % (test_cf, )
print "test_cf.column_metadata : %r" % (test_cf.column_metadata, )

# sys.alter_column('TestKeyspace', 'TestCF', "TestLongColumn", pycassa.system_manager.LONG_TYPE)
# sys.alter_column('TestKeyspace', 'TestCF', "TestLongColumn", "org.apache.cassandra.db.marshal.LongType")

sys.create_index('TestKeyspace', 'TestCF', "TestLongIndex", pycassa.system_manager.LONG_TYPE, index_name='test_TestLongIndex')

## sys.drop_keyspace('TestKeyspace')
sys.close()

fails:
sys.create_index('TestKeyspace', 'TestCF', "TestLongIndex", pycassa.system_manager.LONG_TYPE, index_name='test_TestLongIndex')
File "/usr/share/python2.7/site-packages/pycassa/system_manager.py", line 555, in create_index
File "/usr/share/python2.7/site-packages/pycassa/marshal.py", line 180, in pack_long
struct.error: cannot convert argument to integer