diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-06-03 17:38:35 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-06-06 13:31:54 -0400 |
commit | 3ab2364e78641c4f0e4b6456afc2cbed39b0d0e6 (patch) | |
tree | f3dc26609070c1a357a366592c791a3ec0655483 /lib/sqlalchemy/orm/context.py | |
parent | 14bc09203a8b5b2bc001f764ad7cce6a184975cc (diff) | |
download | sqlalchemy-3ab2364e78641c4f0e4b6456afc2cbed39b0d0e6.tar.gz |
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
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 bd4074ea1..a16db66f6 100644 --- a/lib/sqlalchemy/orm/context.py +++ b/lib/sqlalchemy/orm/context.py @@ -189,7 +189,7 @@ class ORMCompileState(CompileState): @classmethod def orm_pre_session_exec( - cls, session, statement, execution_options, bind_arguments + cls, session, statement, params, execution_options, bind_arguments ): load_options = execution_options.get( "_sa_orm_load_options", QueryContext.default_load_options @@ -216,6 +216,8 @@ class ORMCompileState(CompileState): if load_options._autoflush: session._autoflush() + return execution_options + @classmethod def orm_setup_cursor_result( cls, session, statement, execution_options, bind_arguments, result |