diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-05-08 16:25:30 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-05-08 16:25:30 -0400 |
commit | 074ecc43761f1af1de0d29f077e93f641c73c61e (patch) | |
tree | 6c41939142de2e5464e043da9bb1a46773a6d8d0 /lib/sqlalchemy/sql | |
parent | 6ea6673376609ce6a5e26f9f20425cffee96bcd8 (diff) | |
download | sqlalchemy-074ecc43761f1af1de0d29f077e93f641c73c61e.tar.gz |
- expr.in_() now accepts a text() construct as the argument.
Grouping parenthesis are added automatically, i.e. usage
is like `col.in_(text("select id from table"))`.
[ticket:1793]
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r-- | lib/sqlalchemy/sql/expression.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py index 6dd9d8baf..440c11833 100644 --- a/lib/sqlalchemy/sql/expression.py +++ b/lib/sqlalchemy/sql/expression.py @@ -1522,9 +1522,10 @@ class _CompareMixin(ColumnOperators): # column selectable that does not export itself as a FROM clause return self.__compare( op, seq_or_selectable.as_scalar(), negate=negate_op) - elif isinstance(seq_or_selectable, Selectable): + elif isinstance(seq_or_selectable, (Selectable, _TextClause)): return self.__compare( op, seq_or_selectable, negate=negate_op) - + + # Handle non selectable arguments as sequences args = [] for o in seq_or_selectable: @@ -2358,6 +2359,12 @@ class _TextClause(Executable, ClauseElement): else: return None + def self_group(self, against=None): + if against is operators.in_op: + return _Grouping(self) + else: + return self + def _copy_internals(self, clone=_clone): self.bindparams = dict((b.key, clone(b)) for b in self.bindparams.values()) |