def update(self):
if self.instance is None:<EOL><INDENT>raise CQLEngineException("<STR_LIT>")<EOL><DEDENT>assert type(self.instance) == self.model<EOL>null_clustering_key = False if len(self.instance._clustering_keys) == <NUM_LIT:0> else True<EOL>static_changed_only = True<EOL>statement = UpdateStatement(self.column_family_name, ttl=self._ttl,<EOL>timestamp=self._timestamp, transactions=self._transaction)<EOL>for name, col in self.instance._clustering_keys.items():<EOL><INDENT>null_clustering_key = null_clustering_key and col._val_is_null(getattr(self.instance, name, None))<EOL><DEDENT>for name, col in self.model._columns.items():<EOL><INDENT>if null_clustering_key and not col.static and not col.partition_key:<EOL><INDENT>continue <EOL><DEDENT>if not col.is_primary_key:<EOL><INDENT>val = getattr(self.instance, name, None)<EOL>val_mgr = self.instance._values[name]<EOL>if val is None:<EOL><INDENT>continue<EOL><DEDENT>if not val_mgr.changed and not isinstance(col, Counter):<EOL><INDENT>continue<EOL><DEDENT>static_changed_only = static_changed_only and col.static<EOL>if isinstance(col, (BaseContainerColumn, Counter)):<EOL><INDENT>if isinstance(col, List): klass = ListUpdateClause<EOL>elif isinstance(col, Map): klass = MapUpdateClause<EOL>elif isinstance(col, Set): klass = SetUpdateClause<EOL>elif isinstance(col, Counter): klass = CounterUpdateClause<EOL>else: raise RuntimeError<EOL>clause = klass(col.db_field_name, val,<EOL>previous=val_mgr.previous_value, column=col)<EOL>if clause.get_context_size() > <NUM_LIT:0>:<EOL><INDENT>statement.add_assignment_clause(clause)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>statement.add_assignment_clause(AssignmentClause(<EOL>col.db_field_name,<EOL>col.to_database(val)<EOL>))<EOL><DEDENT><DEDENT><DEDENT>if statement.get_context_size() > <NUM_LIT:0> or self.instance._has_counter:<EOL><INDENT>for name, col in self.model._primary_keys.items():<EOL><INDENT>if (null_clustering_key or static_changed_only) and (not col.partition_key):<EOL><INDENT>continue<EOL><DEDENT>statement.add_where_clause(WhereClause(<EOL>col.db_field_name,<EOL>EqualsOperator(),<EOL>col.to_database(getattr(self.instance, name))<EOL>))<EOL><DEDENT>self._execute(statement)<EOL><DEDENT>if not null_clustering_key:<EOL><INDENT>self._delete_null_columns()<EOL><DEDENT>
updates a row.
This is a blind update call.
All validation and cleaning needs to happen
prior to calling this.