pycassa/pycassa — Issue #91: "columns" parameter is not working in ColumnFamilyMap.insert() method. 
Author: osbornchan
Created: 2011-10-25 00:05:52+00:00
State: open

In pycassa 1.2.1, ColumnFamilyMap.insert() supports "columns" parameter for users to specify which attributes of 'instance' should be inserted or updated.

However, the method logic didn't use the parameter to construct insert_dict.

The following is the code from the insert() method.

if columns is None:
fields = self.fields
else:
fields = columns

insert_dict = {}
for field in self.fields:
val = getattr(instance, field, None)
if val is not None:
insert_dict[field] = val

The logic should be "for field in fields" instead of "for field in self.fields".