diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-08-05 21:47:43 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-08-05 22:13:11 -0400 |
commit | c7b489b25802f7a25ef78d0731411295c611cc1c (patch) | |
tree | f5e3b66ab8eb8bb7398c0195fa2b2f1de8ab91c4 /lib/sqlalchemy/sql/compiler.py | |
parent | 71a3ccbdef0d88e9231b7de9c51e4ed60b3b7181 (diff) | |
download | sqlalchemy-c7b489b25802f7a25ef78d0731411295c611cc1c.tar.gz |
Implement relationship AND criteria; global loader criteria
Added the ability to add arbitrary criteria to the ON clause generated
by a relationship attribute in a query, which applies to methods such
as :meth:`_query.Query.join` as well as loader options like
:func:`_orm.joinedload`. Additionally, a "global" version of the option
allows limiting criteria to be applied to particular entities in
a query globally.
Documentation is minimal at this point, new examples will
be coming in a subsequent commit.
Some adjustments to execution options in how they are represented
in the ORMExecuteState as well as well as a few ORM tests that
forgot to get merged in a preceding commit.
Fixes: #4472
Change-Id: I2b8fc57092dedf35ebd16f6343ad0f0d7d332beb
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r-- | lib/sqlalchemy/sql/compiler.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index ac4055bdf..b8984316c 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -792,6 +792,10 @@ class SQLCompiler(Compiled): def prefetch(self): return list(self.insert_prefetch + self.update_prefetch) + @util.memoized_property + def _global_attributes(self): + return {} + @util.memoized_instancemethod def _init_cte_state(self): """Initialize collections related to CTEs only if |