incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tyler Hobbs <ty...@datastax.com>
Subject Re: How to create counter column family via Pycassa?
Date Wed, 11 Dec 2013 17:08:25 GMT
What options are available depends on what version of Cassandra you're
using.

You can specify the row key type with 'key_validation_class'.

For column types, use 'column_validation_classes', which is a dict mapping
column names to types.  For example:

sys.create_column_family('mykeyspace', 'users',
column_validation_classes={'username': UTF8Type, 'age': IntegerType})


On Wed, Dec 11, 2013 at 10:32 AM, Kumar Ranjan <winnerdood@gmail.com> wrote:

> What are the all possible values for cf_kwargs ??
>
> SYSTEM_MANAGER.create_column_family('Narrative','Twitter_search_test',
> comparator_type=UTF8Type, ???? )
>
> ???? - Here I want to specify, Column data types and row key type. How can
> I do that ?
>
>
> On Thu, Aug 15, 2013 at 12:30 PM, Tyler Hobbs <tyler@datastax.com> wrote:
>
>> The column_validation_classes arg is just for defining individual column
>> types.  Glad you got it figured out, though.
>>
>>
>> On Thu, Aug 15, 2013 at 11:23 AM, Pinak Pani <
>> nishant.has.a.question@gmail.com> wrote:
>>
>>> Thanks for quick reply. Apparantly, I was trying this to get working
>>>
>>> cf_kwargs = {'default_validation_class':COUNTER_COLUMN_TYPE}
>>> sys.create_column_family('my_ks', 'vote_count',
>>> column_validation_classes=cf_kwargs)  #1
>>>
>>> But this works:
>>>
>>> sys.create_column_family('my_ks', 'vote_count', **cf_kwargs)  #2
>>>
>>> I thought #1 should work.
>>>
>>>
>>>
>>> On Thu, Aug 15, 2013 at 9:15 PM, Tyler Hobbs <tyler@datastax.com> wrote:
>>>
>>>> The only thing that makes a CF a counter CF is that the default
>>>> validation class is CounterColumnType, which you can set through
>>>> SystemManager.create_column_family().
>>>>
>>>>
>>>> On Thu, Aug 15, 2013 at 10:38 AM, Pinak Pani <
>>>> nishant.has.a.question@gmail.com> wrote:
>>>>
>>>>> I do not find a way to create a counter column family in Pycassa.
>>>>> This[1] does not help.
>>>>>
>>>>> Appreciate if someone can help me.
>>>>>
>>>>> Thanks
>>>>>
>>>>>  1.
>>>>> http://pycassa.github.io/pycassa/api/pycassa/system_manager.html#pycassa.system_manager.SystemManager.create_column_family
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Tyler Hobbs
>>>> DataStax <http://datastax.com/>
>>>>
>>>
>>>
>>
>>
>> --
>> Tyler Hobbs
>> DataStax <http://datastax.com/>
>>
>
>


-- 
Tyler Hobbs
DataStax <http://datastax.com/>

Mime
View raw message