diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-06-07 09:21:25 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-06-07 09:22:47 -0400 |
commit | 94169108cdd4dace09b752a6af4f4404819b49a3 (patch) | |
tree | 597ebcfd3f1875e0756f41a2af91ac112920e660 /lib/sqlalchemy/orm/context.py | |
parent | 0b33c250a8b78297690c74870a245aada5d5374e (diff) | |
download | sqlalchemy-94169108cdd4dace09b752a6af4f4404819b49a3.tar.gz |
init extra_criteria_entities in fromstatement w/ DML
Fixed issue in experimental "select ORM objects from INSERT/UPDATE" use
case where an error was raised if the statement were against a
single-table-inheritance subclass.
Additionally makes some adjustments in the SQL assertion
fixture to test a FromStatement w/ DML.
Fixes: #6591
Change-Id: I53a627ab18a01dc6d9b5037e28312a1177891327
Diffstat (limited to 'lib/sqlalchemy/orm/context.py')
-rw-r--r-- | lib/sqlalchemy/orm/context.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py index baad28835..d60758ffc 100644 --- a/lib/sqlalchemy/orm/context.py +++ b/lib/sqlalchemy/orm/context.py @@ -431,6 +431,9 @@ class ORMFromStatementCompileState(ORMCompileState): if isinstance( self.statement, (expression.TextClause, expression.UpdateBase) ): + + self.extra_criteria_entities = {} + # setup for all entities. Currently, this is not useful # for eager loaders, as the eager loaders that work are able # to do their work entirely in row_processor. @@ -709,7 +712,6 @@ class ORMSelectCompileState(ORMCompileState, SelectState): # i.e. when each _MappedEntity has its own FROM if self.compile_options._enable_single_crit: - self._adjust_for_extra_criteria() if not self.primary_columns: |