Updates a model.

    :include_keys: if given, only updates the given attributes. Otherwise, updates all non-id
    attributes.

def update_model(self, model, *, include_keys=None):
    """Updates a model.

    :include_keys: if given, only updates the given attributes. Otherwise, updates all non-id
    attributes.
    """
    id_constraints = get_model_id_constraints(model)

    if include_keys is None:
      include_keys = set(
        model.attrs.keys()).difference(model.exclude_keys_sql).difference(id_constraints.keys())

    # If include_keys was not null but was empty
    if not include_keys:
      return model

    values = model.to_dict(include_keys=include_keys)
    returnings = []

    _, updated_ts = model.timestamps if model.timestamps else (None, None)

    if updated_ts and updated_ts not in values:
      values[updated_ts] = utc_now() if self.core.supports_timezones else local_now()
      returnings.append(updated_ts)

    returning = ", ".join(returnings)
    cr = self.update(model.table_name, values, id_constraints, returning=returning)

    if returning and self.core.supports_returning_syntax:
      rec = cr.fetchone()
      for idx, attr_name in enumerate(returnings):
        setattr(model, attr_name, rec[idx])

    return model