nam
nam

Reputation: 3632

Specify column type in pycassa

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

Upvotes: 0

Views: 276

Answers (2)

Arun Kumar M S
Arun Kumar M S

Reputation: 71

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

Upvotes: 0

abhi
abhi

Reputation: 4792

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)

Upvotes: 2

Related Questions