diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-12-01 17:24:27 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-05-24 11:54:08 -0400 |
commit | dce8c7a125cb99fad62c76cd145752d5afefae36 (patch) | |
tree | 352dfa2c38005207ca64f45170bbba2c0f8c927e /examples | |
parent | 1502b5b3e4e4b93021eb927a6623f288ef006ba6 (diff) | |
download | sqlalchemy-dce8c7a125cb99fad62c76cd145752d5afefae36.tar.gz |
Unify Query and select() , move all processing to compile phase
Convert Query to do virtually all compile state computation
in the _compile_context() phase, and organize it all
such that a plain select() construct may also be used as the
source of information in order to generate ORM query state.
This makes it such that Query is not needed except for
its additional methods like from_self() which are all to
be deprecated.
The construction of ORM state will occur beyond the
caching boundary when the new execution model is integrated.
future select() gains a working join() and filter_by() method.
as we continue to rebase and merge each commit in the steps,
callcounts continue to bump around. will have to look at
the final result when it's all in.
References: #5159
References: #4705
References: #4639
References: #4871
References: #5010
Change-Id: I19e05b3424b07114cce6c439b05198ac47f7ac10
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dogpile_caching/caching_query.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/examples/dogpile_caching/caching_query.py b/examples/dogpile_caching/caching_query.py index 19e71ad4d..d6e1435b0 100644 --- a/examples/dogpile_caching/caching_query.py +++ b/examples/dogpile_caching/caching_query.py @@ -48,8 +48,20 @@ class CachingQuery(Query): # NOTE: as of 1.4 don't override __iter__() anymore, the result object # cannot be cached at that level. - def _execute_and_instances(self, context): - """override _execute_and_instances to pull results from dogpile. + def _execute_and_instances(self, context, **kw): + """override _execute_and_instances to pull results from dogpile + if the query is invoked directly from an external context. + + This method is necessary in order to maintain compatibility + with the "baked query" system now used by default in some + relationship loader scenarios. Note also the + RelationshipCache._generate_cache_key method which enables + the baked query to be used within lazy loads. + + .. versionadded:: 1.2.7 + + .. versionchanged:: 1.4 Added ``**kw`` arguments to the signature. + """ super_ = super(CachingQuery, self) @@ -58,11 +70,11 @@ class CachingQuery(Query): # method is called directly from the baked query return self.get_value( createfunc=lambda: super_._execute_and_instances( - context + context, **kw ).freeze() ) else: - return super_._execute_and_instances(context) + return super_._execute_and_instances(context, **kw) def _get_cache_plus_key(self): """Return a cache region plus key.""" |