How to column family count using pycassa

79 Views Asked by At

Does anyone know how to get column family count using pycassa? I was able to get the key space count. but don't see an option to get the column family count.

system = SystemManager(server, auth)
keyspaces = system.list_keyspaces()
print len(keyspaces)
1

There are 1 best solutions below

2
Ashraful Islam On

Use get_keyspace_column_families(keyspace, use_dict_for_col_metadata=False)

Returns a raw description of the keyspace

If use_dict_for_col_metadata is True, the CfDef’s column_metadata will be stored as a dictionary where the keys are column names instead of a list.

Returns a dictionary of the form {column_family_name: CfDef}

Example to show number of column families in keyspace : my_keyspace

print len(system.get_keyspace_column_families('my_keyspace'))