diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-06-28 12:47:32 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-06-29 13:46:44 -0400 |
commit | 0286dcb23d8f6facb09391b46581d525982c20a0 (patch) | |
tree | 255d38af67598d2cf6341b7e95d3acd0d18fb431 /lib/sqlalchemy/ext/baked.py | |
parent | 5f5b56d646f154ee572c9de80449423304103bad (diff) | |
download | sqlalchemy-0286dcb23d8f6facb09391b46581d525982c20a0.tar.gz |
Remove _generate_path_cache_key()
loader options can now make a deterministic cache key based
on the structure they are given, and this accommodates for
aliased classes as well so that these cache keys are now
"safe". Have baked query call upon
the regular cache key method.
Change-Id: Iaa2ef4064cfb16146f415ca73080f32003dd830d
Diffstat (limited to 'lib/sqlalchemy/ext/baked.py')
-rw-r--r-- | lib/sqlalchemy/ext/baked.py | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/lib/sqlalchemy/ext/baked.py b/lib/sqlalchemy/ext/baked.py index 4f40637c5..ecbf871e2 100644 --- a/lib/sqlalchemy/ext/baked.py +++ b/lib/sqlalchemy/ext/baked.py @@ -194,18 +194,13 @@ class BakedQuery(object): if not cache_path: cache_path = effective_path - if cache_path.path[0].is_aliased_class: - # paths that are against an AliasedClass are unsafe to cache - # with since the AliasedClass is an ad-hoc object. - self.spoil(full=True) - else: - for opt in options: - if opt._is_legacy_option or opt._is_compile_state: - cache_key = opt._generate_path_cache_key(cache_path) - if cache_key is False: - self.spoil(full=True) - elif cache_key is not None: - key += cache_key + for opt in options: + if opt._is_legacy_option or opt._is_compile_state: + ck = opt._generate_cache_key() + if ck is None: + self.spoil(full=True) + else: + key += ck[0] self.add_criteria( lambda q: q._with_current_path(effective_path).options(*options), |