From 3dc9a4a2392d033f9d1bd79dd6b6ecea6281a61c Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 16 Dec 2019 17:06:43 -0500 Subject: introduce deferred lambdas The coercions system allows us to add in lambdas as arguments to Core and ORM elements without changing them at all. By allowing the lambda to produce a deterministic cache key where we can also cheat and yank out literal parameters means we can move towards having 90% of "baked" functionality in a clearer way right in Core / ORM. As a second step, we can have whole statements inside the lambda, and can then add generation with __add__(), so then we have 100% of "baked" functionality with full support of ad-hoc literal values. Adds some more short_selects tests for the moment for comparison. Other tweaks inside cache key generation as we're trying to approach a certain level of performance such that we can remove the use of "baked" from the loader strategies. As we have not yet closed #4639, however the caching feature has been fully integrated as of b0cfa7379cf8513a821a3dbe3028c4965d9f85bd, we will also add complete caching documentation here and close that issue as well. Closes: #4639 Fixes: #5380 Change-Id: If91f61527236fd4d7ae3cad1f24c38be921c90ba --- lib/sqlalchemy/sql/functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/sql/functions.py') diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py index 6fff26842..c1b8bbd27 100644 --- a/lib/sqlalchemy/sql/functions.py +++ b/lib/sqlalchemy/sql/functions.py @@ -614,7 +614,7 @@ class Function(FunctionElement): new :class:`.Function` instances. """ - self.packagenames = kw.pop("packagenames", None) or [] + self.packagenames = kw.pop("packagenames", None) or () self.name = name self._bind = kw.get("bind", None) self.type = sqltypes.to_instance(kw.get("type_", None)) @@ -759,7 +759,7 @@ class GenericFunction(util.with_metaclass(_GenericMeta, Function)): for c in args ] self._has_args = self._has_args or bool(parsed_args) - self.packagenames = [] + self.packagenames = () self._bind = kwargs.get("bind", None) self.clause_expr = ClauseList( operator=operators.comma_op, group_contents=True, *parsed_args -- cgit v1.2.1