]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Enhance "raise" strategy to include "raise_on_sql" option
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 3 Oct 2016 19:55:04 +0000 (15:55 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 4 Oct 2016 16:09:29 +0000 (12:09 -0400)
commit95d4cd30420414fcede2662aed87b0f2e5a861d4
treeb77df1c621fdea15a95a784fae5c76765c117bbd
parent728ce8cc480d0ada690e5a97067cff821b9a65f3
Enhance "raise" strategy to include "raise_on_sql" option

The "raise_on_sql" option differentiates from "raise" in that
firing a lazy loader is OK as long as it does a simple
get from identity map.   Whereas "raise" is more useful
for the case that objects are to be detached.

As part of this, refactors the strategy initiation logic
a bit so that a LoaderStrategy itself knows what "key" was used
to create it, thus allowing variants of a single strategy
based on what the "lazy" argument is.  To achieve this we
have to also get rid of _get_strategy_by_cls().

Everything here is internal with the one exception of an apparently
undocumented, but not underscored, "strategy_class" key
on relationship().   Though it's not clear what
"strategy_class" accomplishes; at this point the strategy
system is extensible using Property.strategy_for().

Fixes: #3812
Change-Id: I812ad878ea5cf764e15f6f71cb39eee78a645d88
doc/build/changelog/changelog_11.rst
doc/build/changelog/migration_11.rst
lib/sqlalchemy/orm/descriptor_props.py
lib/sqlalchemy/orm/interfaces.py
lib/sqlalchemy/orm/properties.py
lib/sqlalchemy/orm/relationships.py
lib/sqlalchemy/orm/strategies.py
lib/sqlalchemy/orm/strategy_options.py
test/ext/test_baked.py
test/orm/test_mapper.py