def rewrite_update(clauseelement, multiparams, params):
newmultiparams = []<EOL>_multiparams = multiparams[<NUM_LIT:0>]<EOL>if len(_multiparams) == <NUM_LIT:0>:<EOL><INDENT>return clauseelement, multiparams, params<EOL><DEDENT>for _params in _multiparams:<EOL><INDENT>newparams = {}<EOL>for key, val in _params.items():<EOL><INDENT>if (<EOL>not isinstance(val, MutableDict) or<EOL>(not any(val._changed_keys) and not any(val._deleted_keys))<EOL>):<EOL><INDENT>newparams[key] = val<EOL>continue<EOL><DEDENT>for subkey, subval in val.items():<EOL><INDENT>if subkey in val._changed_keys:<EOL><INDENT>newparams["<STR_LIT>".format(key, subkey)] = subval<EOL><DEDENT><DEDENT>for subkey in val._deleted_keys:<EOL><INDENT>newparams["<STR_LIT>".format(key, subkey)] = None<EOL><DEDENT><DEDENT>newmultiparams.append(newparams)<EOL><DEDENT>_multiparams = (newmultiparams, )<EOL>clause = clauseelement.values(newmultiparams[<NUM_LIT:0>])<EOL>clause._crate_specific = True<EOL>return clause, _multiparams, params<EOL>
change the params to enable partial updates

    sqlalchemy by default only supports updates of complex types in the form of

        "col = ?", ({"x": 1, "y": 2}

    but crate supports

        "col['x'] = ?, col['y'] = ?", (1, 2)

    by using the `Craty` (`MutableDict`) type.
    The update statement is only rewritten if an item of the MutableDict was
    changed.