pycassa/pycassa — Issue #124: Manual Override of Column Validator Fails
Author: elubow
Created: 2012-03-05 16:11:06+00:00
State: open

Manually overriding the column validator for CFs with non-Bytes/AsciiType column names fails in Pycassa 1.5.1 under Python 2.7.

This is present when attempting to use the column_validators to change the column type to be a type not used in the schema. For instance, if the default CF type is ```UTF8Type()``` and you want to add a column that is a ```BooleanType()``` column:

```python
from pycassa.types import BooleanType
...
my_column_family.column_validators[('foo', 'bar')] = BooleanType()
columns[('foo','bar')] = True
my_column_family.insert(row_key,columns)
```

Here is the workaround given by @thobbs:

```python
from pycassa.types import BooleanType
from pycassa.marshal import get_composite_packer
...
pack = get_composite_packer(str(my_column_family.column_name_class))
my_column_family.column_validators[pack(('foo', 'bar'))] = BooleanType()
```