diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-10-29 23:21:13 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-10-29 23:23:26 -0400 |
| commit | 163a97c6d57db09d6405124dae9b877bc9629721 (patch) | |
| tree | a2d03a838965ad9ccbdda01d54ad24a9b4a8c1f3 /lib/sqlalchemy | |
| parent | b9f7a92d821a31e48f7ce20ef848e73571c644fa (diff) | |
| download | sqlalchemy-163a97c6d57db09d6405124dae9b877bc9629721.tar.gz | |
rename "bulk" UPDATE and DELETE to not use the word "bulk"
This term confuses this feature with the lesser used
"bulk insert/update" feature, and also "bulk" is not as
descriptive here as only a single statement is run; there's
not a large set of data passed in.
For now call it UPDATE/DELETE with arbitrary WHERE clause,
or ORM-enabled UPDATE/DELETE.
Change-Id: I317fcda9d73d4c2dd250031a745dd3d72e4f1fc6
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/orm/events.py | 6 | ||||
| -rw-r--r-- | lib/sqlalchemy/orm/query.py | 24 |
2 files changed, 17 insertions, 13 deletions
diff --git a/lib/sqlalchemy/orm/events.py b/lib/sqlalchemy/orm/events.py index 4e11ebb8c..a0e100a81 100644 --- a/lib/sqlalchemy/orm/events.py +++ b/lib/sqlalchemy/orm/events.py @@ -1798,7 +1798,8 @@ class SessionEvents(event.Events): ), ) def after_bulk_update(self, update_context): - """Execute after a bulk update operation to the session. + """Execute after an ORM UPDATE against a WHERE expression has been + invoked. This is called as a result of the :meth:`_query.Query.update` method. @@ -1837,7 +1838,8 @@ class SessionEvents(event.Events): ), ) def after_bulk_delete(self, delete_context): - """Execute after a bulk delete operation to the session. + """Execute after ORM DELETE against a WHERE expression has been + invoked. This is called as a result of the :meth:`_query.Query.delete` method. diff --git a/lib/sqlalchemy/orm/query.py b/lib/sqlalchemy/orm/query.py index df1a048f3..277dda6fb 100644 --- a/lib/sqlalchemy/orm/query.py +++ b/lib/sqlalchemy/orm/query.py @@ -3033,7 +3033,7 @@ class Query( return self._from_self(col).scalar() def delete(self, synchronize_session="evaluate"): - r"""Perform a bulk delete query. + r"""Perform a DELETE with an arbitrary WHERE clause. Deletes rows matched by this query from the database. @@ -3047,20 +3047,21 @@ class Query( .. warning:: - See the section :ref:`bulk_update_delete` for important caveats - and warnings, including limitations when using bulk UPDATE + See the section :ref:`orm_expression_update_delete` for important + caveats and warnings, including limitations when using bulk UPDATE and DELETE with mapper inheritance configurations. :param synchronize_session: chooses the strategy to update the attributes on objects in the session. See the section - :ref:`bulk_update_delete` for a discussion of these strategies. + :ref:`orm_expression_update_delete` for a discussion of these + strategies. :return: the count of rows matched as returned by the database's "row count" feature. .. seealso:: - :ref:`bulk_update_delete` + :ref:`orm_expression_update_delete` """ @@ -3087,7 +3088,7 @@ class Query( return result.rowcount def update(self, values, synchronize_session="evaluate", update_args=None): - r"""Perform a bulk update query. + r"""Perform an UPDATE with an arbitrary WHERE clause. Updates rows matched by this query in the database. @@ -3101,9 +3102,9 @@ class Query( .. warning:: - See the section :ref:`bulk_update_delete` for important caveats - and warnings, including limitations when using bulk UPDATE - and DELETE with mapper inheritance configurations. + See the section :ref:`orm_expression_update_delete` for important + caveats and warnings, including limitations when using arbitrary + UPDATE and DELETE with mapper inheritance configurations. :param values: a dictionary with attributes names, or alternatively mapped attributes or SQL expressions, as keys, and literal @@ -3117,7 +3118,8 @@ class Query( :param synchronize_session: chooses the strategy to update the attributes on objects in the session. See the section - :ref:`bulk_update_delete` for a discussion of these strategies. + :ref:`orm_expression_update_delete` for a discussion of these + strategies. :param update_args: Optional dictionary, if present will be passed to the underlying :func:`_expression.update` @@ -3132,7 +3134,7 @@ class Query( .. seealso:: - :ref:`bulk_update_delete` + :ref:`orm_expression_update_delete` """ |
