From 3ab2364e78641c4f0e4b6456afc2cbed39b0d0e6 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 3 Jun 2020 17:38:35 -0400 Subject: Convert bulk update/delete to new execution model This reorganizes the BulkUD model in sqlalchemy.orm.persistence to be based on the CompileState concept and to allow plain update() / delete() to be passed to session.execute() where the ORM synchronize session logic will take place. Also gets "synchronize_session='fetch'" working with horizontal sharding. Adding a few more result.scalar_one() types of methods as scalar_one() seems like what is normally desired. Fixes: #5160 Change-Id: I8001ebdad089da34119eb459709731ba6c0ba975 --- lib/sqlalchemy/sql/selectable.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/sqlalchemy/sql/selectable.py') diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index d6845e05f..a95fc561a 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -789,7 +789,7 @@ class FromClause(roles.AnonymizedFromClauseRole, Selectable): self._reset_column_collection() -class Join(FromClause): +class Join(roles.DMLTableRole, FromClause): """represent a ``JOIN`` construct between two :class:`_expression.FromClause` elements. @@ -1406,7 +1406,7 @@ class AliasedReturnsRows(NoInit, FromClause): return self.element.bind -class Alias(AliasedReturnsRows): +class Alias(roles.DMLTableRole, AliasedReturnsRows): """Represents an table or selectable alias (AS). Represents an alias, as typically applied to any table or @@ -1987,7 +1987,7 @@ class FromGrouping(GroupedElement, FromClause): self.element = state["element"] -class TableClause(Immutable, FromClause): +class TableClause(roles.DMLTableRole, Immutable, FromClause): """Represents a minimal "table" construct. This is a lightweight table object that has only a name, a -- cgit v1.2.1