summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-02-07 00:56:05 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2010-02-07 00:56:05 +0000
commit1c73149d5dd477ae882890e155e87f5dd9e4853f (patch)
tree1433f2fa80a06b2619f6aea5f12f0018572861a6 /lib/sqlalchemy/sql
parent54df3ee2ab1052533f49e596d902d597eb140c52 (diff)
downloadsqlalchemy-1c73149d5dd477ae882890e155e87f5dd9e4853f.tar.gz
- FunctionElement subclasses are now directly executable the
same way any func.foo() construct is, with automatic SELECT being applied when passed to execute(). - The "type" and "bind" keyword arguments of a func.foo() construct are now local to "func." constructs and are not part of the FunctionElement base class, allowing a "type" to be handled in a custom constructor or class-level variable.
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/expression.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py
index 89137d2ce..878b0d826 100644
--- a/lib/sqlalchemy/sql/expression.py
+++ b/lib/sqlalchemy/sql/expression.py
@@ -2481,15 +2481,13 @@ class _Case(ColumnElement):
class FunctionElement(ColumnElement, FromClause):
"""Base for SQL function-oriented constructs."""
-
+
def __init__(self, *clauses, **kwargs):
- self._bind = kwargs.get('bind', None)
args = [_literal_as_binds(c, self.name) for c in clauses]
self.clause_expr = ClauseList(
operator=operators.comma_op,
group_contents=True, *args).\
self_group()
- self.type = sqltypes.to_instance(kwargs.get('type_', None))
@property
def columns(self):
@@ -2535,6 +2533,9 @@ class Function(FunctionElement):
def __init__(self, name, *clauses, **kw):
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))
+
FunctionElement.__init__(self, *clauses, **kw)
def _bind_param(self, obj):