diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-08-05 17:58:48 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-08-05 18:53:17 -0400 |
commit | 71a3ccbdef0d88e9231b7de9c51e4ed60b3b7181 (patch) | |
tree | 3251bd2b54584f832f7c1f31283ddfb675df3495 /lib/sqlalchemy/sql/base.py | |
parent | cc57ea495f6460dd56daa6de57e40047ed999369 (diff) | |
download | sqlalchemy-71a3ccbdef0d88e9231b7de9c51e4ed60b3b7181.tar.gz |
Convert lazy loader, selectinload, load_on_ident to lambda statements
Building on newly robust lambdas in
I29a513c98917b1d503abfdd61e6b6e8800851aa8,
convert key loading off of the "baked" system so that baked
is no longer used by the ORM.
Change-Id: I3abfb45dd6e50f84f29d39434caa0b550ce27864
Diffstat (limited to 'lib/sqlalchemy/sql/base.py')
-rw-r--r-- | lib/sqlalchemy/sql/base.py | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py index 36a8151d3..dc2804691 100644 --- a/lib/sqlalchemy/sql/base.py +++ b/lib/sqlalchemy/sql/base.py @@ -16,6 +16,7 @@ import re from . import roles from .traversals import HasCacheKey # noqa +from .traversals import HasCopyInternals # noqa from .traversals import MemoizedHasCacheKey # noqa from .visitors import ClauseVisitor from .visitors import ExtendedInternalTraversal @@ -699,6 +700,20 @@ class CacheableOptions(Options, HasCacheKey): return HasCacheKey._generate_cache_key_for_object(self) +class ExecutableOption(HasCopyInternals, HasCacheKey): + _annotations = util.EMPTY_DICT + + __visit_name__ = "executable_option" + + def _clone(self): + """Create a shallow copy of this ExecutableOption. + + """ + c = self.__class__.__new__(self.__class__) + c.__dict__ = dict(self.__dict__) + return c + + class Executable(Generative): """Mark a :class:`_expression.ClauseElement` as supporting execution. @@ -715,11 +730,18 @@ class Executable(Generative): _with_context_options = () _executable_traverse_internals = [ - ("_with_options", ExtendedInternalTraversal.dp_has_cache_key_list), + ("_with_options", InternalTraversal.dp_executable_options), ("_with_context_options", ExtendedInternalTraversal.dp_plain_obj), ("_propagate_attrs", ExtendedInternalTraversal.dp_propagate_attrs), ] + is_select = False + is_update = False + is_insert = False + is_text = False + is_delete = False + is_dml = False + @property def _effective_plugin_target(self): return self.__visit_name__ @@ -759,6 +781,22 @@ class Executable(Generative): ) @_generative + def _set_compile_options(self, compile_options): + """Assign the compile options to a new value. + + :param compile_options: appropriate CacheableOptions structure + + """ + + self._compile_options = compile_options + + @_generative + def _update_compile_options(self, options): + """update the _compile_options with new keys.""" + + self._compile_options += options + + @_generative def _add_context_option(self, callable_, cache_args): """Add a context option to this statement. |