def save(self):
if self.instance is None:<EOL><INDENT>raise CQLEngineException("<STR_LIT>")<EOL><DEDENT>assert type(self.instance) == self.model<EOL>nulled_fields = set()<EOL>if self.instance._has_counter or self.instance._can_update():<EOL><INDENT>return self.update()<EOL><DEDENT>else:<EOL><INDENT>insert = InsertStatement(self.column_family_name, ttl=self._ttl, timestamp=self._timestamp, if_not_exists=self._if_not_exists)<EOL>static_save_only = False if len(self.instance._clustering_keys) == <NUM_LIT:0> else True<EOL>for name, col in self.instance._clustering_keys.items():<EOL><INDENT>static_save_only = static_save_only and col._val_is_null(getattr(self.instance, name, None))<EOL><DEDENT>for name, col in self.instance._columns.items():<EOL><INDENT>if static_save_only and not col.static and not col.partition_key:<EOL><INDENT>continue <EOL><DEDENT>val = getattr(self.instance, name, None)<EOL>if col._val_is_null(val):<EOL><INDENT>if self.instance._values[name].changed:<EOL><INDENT>nulled_fields.add(col.db_field_name)<EOL><DEDENT>continue<EOL><DEDENT>insert.add_assignment_clause(AssignmentClause(<EOL>col.db_field_name,<EOL>col.to_database(getattr(self.instance, name, None))<EOL>))<EOL><DEDENT><DEDENT>if not insert.is_empty:<EOL><INDENT>self._execute(insert)<EOL><DEDENT>if not static_save_only:<EOL><INDENT>self._delete_null_columns()<EOL><DEDENT>
Creates / updates a row.
This is a blind insert call.
All validation and cleaning needs to happen
prior to calling this.