Question

I want to do the equivalence of these CLI command in pycassa:

CREATE COLUMN FAMILY users
WITH comparator = UTF8Type
AND key_validation_class=UTF8Type
AND column_metadata = [
{column_name: full_name, validation_class: UTF8Type}
{column_name: email, validation_class: UTF8Type}
{column_name: state, validation_class: UTF8Type}
{column_name: gender, validation_class: UTF8Type}
{column_name: birth_year, validation_class: LongType}
];

What is the equivalence in pycassa? Thanks

Was it helpful?

Solution

You can try this. Don't know much about python client, still ...

 validators = {'full_name': UTF8_TYPE,
              'email': UTF8_TYPE,
              'state': UTF8_TYPE,
              'gender': UTF8_TYPE,
              'birth_year': LONG_TYPE}
 sys.create_column_family('TestKeyspace', 'TestCF', super=False,
              comparator_type=UTF8Type,
              key_validation_class=UTF8Type, 
              column_validation_classes=validators)

OTHER TIPS

To answer your other question: key_validation_class='CompositeType(UTF8Type, UTF8Type)'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top