def update(self, values, synchronize_session='evaluate'):
    'Perform a bulk update query.\n\n        Updates rows matched by this query in the database.\n\n        E.g.::\n\n            sess.query(User).filter(User.age == 25).                update({User.age: User.age - 10}, synchronize_session=\'fetch\')\n\n\n            sess.query(User).filter(User.age == 25).                update({"age": User.age - 10}, synchronize_session=\'evaluate\')\n\n\n        :param values: a dictionary with attributes names, or alternatively\n          mapped attributes or SQL expressions, as keys, and literal\n          values or sql expressions as values.\n\n          .. versionchanged:: 1.0.0 - string names in the values dictionary\n             are now resolved against the mapped entity; previously, these\n             strings were passed as literal column names with no mapper-level\n             translation.\n\n        :param synchronize_session: chooses the strategy to update the\n            attributes on objects in the session. Valid values are:\n\n            ``False`` - don\'t synchronize the session. This option is the most\n            efficient and is reliable once the session is expired, which\n            typically occurs after a commit(), or explicitly using\n            expire_all(). Before the expiration, updated objects may still\n            remain in the session with stale values on their attributes, which\n            can lead to confusing results.\n\n            ``\'fetch\'`` - performs a select query before the update to find\n            objects that are matched by the update query. The updated\n            attributes are expired on matched objects.\n\n            ``\'evaluate\'`` - Evaluate the Query\'s criteria in Python straight\n            on the objects in the session. If evaluation of the criteria isn\'t\n            implemented, an exception is raised.\n\n            The expression evaluator currently doesn\'t account for differing\n            string collations between the database and Python.\n\n        :return: the count of rows matched as returned by the database\'s\n          "row count" feature.\n\n        This method has several key caveats:\n\n        * The method does **not** offer in-Python cascading of relationships\n          - it is assumed that ON UPDATE CASCADE is configured for any foreign\n          key references which require it, otherwise the database may emit an\n          integrity violation if foreign key references are being enforced.\n\n          After the UPDATE, dependent objects in the :class:`.Session` which\n          were impacted by an ON UPDATE CASCADE may not contain the current\n          state; this issue is resolved once the :class:`.Session` is expired,\n          which normally occurs upon :meth:`.Session.commit` or can be forced\n          by using :meth:`.Session.expire_all`.\n\n        * The method supports multiple table updates, as\n          detailed in :ref:`multi_table_updates`, and this behavior does\n          extend to support updates of joined-inheritance and other multiple\n          table mappings.  However, the **join condition of an inheritance\n          mapper is currently not automatically rendered**.\n          Care must be taken in any multiple-table update to explicitly\n          include the joining condition between those tables, even in mappings\n          where this is normally automatic.\n          E.g. if a class ``Engineer`` subclasses ``Employee``, an UPDATE of\n          the ``Engineer`` local table using criteria against the ``Employee``\n          local table might look like::\n\n                session.query(Engineer).\\\n                    filter(Engineer.id == Employee.id).\\\n                    filter(Employee.name == \'dilbert\').\\\n                    update({"engineer_type": "programmer"})\n\n        * The :meth:`.MapperEvents.before_update` and\n          :meth:`.MapperEvents.after_update`\n          events are **not** invoked from this method.  Instead, the\n          :meth:`.SessionEvents.after_bulk_update` method is provided to act\n          upon a mass UPDATE of entity rows.\n\n        .. seealso::\n\n            :meth:`.Query.delete`\n\n            :ref:`inserts_and_updates` - Core SQL tutorial\n\n        '
    update_op = persistence.BulkUpdate.factory(self, synchronize_session, values)
    update_op.exec_()
    return update_op.rowcount
Perform a bulk update query.

Updates rows matched by this query in the database.

E.g.::

    sess.query(User).filter(User.age == 25).                update({User.age: User.age - 10}, synchronize_session='fetch')


    sess.query(User).filter(User.age == 25).                update({"age": User.age - 10}, synchronize_session='evaluate')


:param values: a dictionary with attributes names, or alternatively
  mapped attributes or SQL expressions, as keys, and literal
  values or sql expressions as values.

  .. versionchanged:: 1.0.0 - string names in the values dictionary
     are now resolved against the mapped entity; previously, these
     strings were passed as literal column names with no mapper-level
     translation.

:param synchronize_session: chooses the strategy to update the
    attributes on objects in the session. Valid values are:

    ``False`` - don't synchronize the session. This option is the most
    efficient and is reliable once the session is expired, which
    typically occurs after a commit(), or explicitly using
    expire_all(). Before the expiration, updated objects may still
    remain in the session with stale values on their attributes, which
    can lead to confusing results.

    ``'fetch'`` - performs a select query before the update to find
    objects that are matched by the update query. The updated
    attributes are expired on matched objects.

    ``'evaluate'`` - Evaluate the Query's criteria in Python straight
    on the objects in the session. If evaluation of the criteria isn't
    implemented, an exception is raised.

    The expression evaluator currently doesn't account for differing
    string collations between the database and Python.

:return: the count of rows matched as returned by the database's
  "row count" feature.

This method has several key caveats:

* The method does **not** offer in-Python cascading of relationships
  - it is assumed that ON UPDATE CASCADE is configured for any foreign
  key references which require it, otherwise the database may emit an
  integrity violation if foreign key references are being enforced.

  After the UPDATE, dependent objects in the :class:`.Session` which
  were impacted by an ON UPDATE CASCADE may not contain the current
  state; this issue is resolved once the :class:`.Session` is expired,
  which normally occurs upon :meth:`.Session.commit` or can be forced
  by using :meth:`.Session.expire_all`.

* The method supports multiple table updates, as
  detailed in :ref:`multi_table_updates`, and this behavior does
  extend to support updates of joined-inheritance and other multiple
  table mappings.  However, the **join condition of an inheritance
  mapper is currently not automatically rendered**.
  Care must be taken in any multiple-table update to explicitly
  include the joining condition between those tables, even in mappings
  where this is normally automatic.
  E.g. if a class ``Engineer`` subclasses ``Employee``, an UPDATE of
  the ``Engineer`` local table using criteria against the ``Employee``
  local table might look like::

        session.query(Engineer).\
            filter(Engineer.id == Employee.id).\
            filter(Employee.name == 'dilbert').\
            update({"engineer_type": "programmer"})

* The :meth:`.MapperEvents.before_update` and
  :meth:`.MapperEvents.after_update`
  events are **not** invoked from this method.  Instead, the
  :meth:`.SessionEvents.after_bulk_update` method is provided to act
  upon a mass UPDATE of entity rows.

.. seealso::

    :meth:`.Query.delete`

    :ref:`inserts_and_updates` - Core SQL tutorial
def update(self, values, synchronize_session='evaluate'):
    'Perform a bulk update query.\n\n        Updates rows matched by this query in the database.\n\n        E.g.::\n\n            sess.query(User).filter(User.age == 25).                update({User.age: User.age - 10}, synchronize_session=\'fetch\')\n\n\n            sess.query(User).filter(User.age == 25).                update({"age": User.age - 10}, synchronize_session=\'evaluate\')\n\n\n        :param values: a dictionary with attributes names, or alternatively\n          mapped attributes or SQL expressions, as keys, and literal\n          values or sql expressions as values.\n\n          .. versionchanged:: 1.0.0 - string names in the values dictionary\n             are now resolved against the mapped entity; previously, these\n             strings were passed as literal column names with no mapper-level\n             translation.\n\n        :param synchronize_session: chooses the strategy to update the\n            attributes on objects in the session. Valid values are:\n\n            ``False`` - don\'t synchronize the session. This option is the most\n            efficient and is reliable once the session is expired, which\n            typically occurs after a commit(), or explicitly using\n            expire_all(). Before the expiration, updated objects may still\n            remain in the session with stale values on their attributes, which\n            can lead to confusing results.\n\n            ``\'fetch\'`` - performs a select query before the update to find\n            objects that are matched by the update query. The updated\n            attributes are expired on matched objects.\n\n            ``\'evaluate\'`` - Evaluate the Query\'s criteria in Python straight\n            on the objects in the session. If evaluation of the criteria isn\'t\n            implemented, an exception is raised.\n\n            The expression evaluator currently doesn\'t account for differing\n            string collations between the database and Python.\n\n        :return: the count of rows matched as returned by the database\'s\n          "row count" feature.\n\n        This method has several key caveats:\n\n        * The method does **not** offer in-Python cascading of relationships\n          - it is assumed that ON UPDATE CASCADE is configured for any foreign\n          key references which require it, otherwise the database may emit an\n          integrity violation if foreign key references are being enforced.\n\n          After the UPDATE, dependent objects in the :class:`.Session` which\n          were impacted by an ON UPDATE CASCADE may not contain the current\n          state; this issue is resolved once the :class:`.Session` is expired,\n          which normally occurs upon :meth:`.Session.commit` or can be forced\n          by using :meth:`.Session.expire_all`.\n\n        * The method supports multiple table updates, as\n          detailed in :ref:`multi_table_updates`, and this behavior does\n          extend to support updates of joined-inheritance and other multiple\n          table mappings.  However, the **join condition of an inheritance\n          mapper is currently not automatically rendered**.\n          Care must be taken in any multiple-table update to explicitly\n          include the joining condition between those tables, even in mappings\n          where this is normally automatic.\n          E.g. if a class ``Engineer`` subclasses ``Employee``, an UPDATE of\n          the ``Engineer`` local table using criteria against the ``Employee``\n          local table might look like::\n\n                session.query(Engineer).\\\n                    filter(Engineer.id == Employee.id).\\\n                    filter(Employee.name == \'dilbert\').\\\n                    update({"engineer_type": "programmer"})\n\n        * The :meth:`.MapperEvents.before_update` and\n          :meth:`.MapperEvents.after_update`\n          events are **not** invoked from this method.  Instead, the\n          :meth:`.SessionEvents.after_bulk_update` method is provided to act\n          upon a mass UPDATE of entity rows.\n\n        .. seealso::\n\n            :meth:`.Query.delete`\n\n            :ref:`inserts_and_updates` - Core SQL tutorial\n\n        '
    update_op = persistence.BulkUpdate.factory(self, synchronize_session, values)
    update_op.exec_()
    return update_op.rowcount