diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-02-01 01:47:54 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-02-01 01:47:54 +0000 |
commit | 72f479b324c0b62a19e58c7b173a62b55c34a928 (patch) | |
tree | 537353c7423a1be7556300cd7f3a059a924a68d1 /lib/sqlalchemy/util.py | |
parent | 7a429e2bb60939fb939d07014d5c3b7c020fdcbf (diff) | |
download | sqlalchemy-72f479b324c0b62a19e58c7b173a62b55c34a928.tar.gz |
- improved support for complex queries embedded into "where" criterion
for query.select() [ticket:449]
- contains_eager('foo') automatically implies eagerload('foo')
- query.options() can take a combiantion MapperOptions and tuples of MapperOptions,
so that functions can return groups
- refactoring to Aliasizer and ClauseAdapter so that they share a common base methodology,
which addresses all sql.ColumnElements instead of just schema.Column. common list-processing
methods added.
- query.compile and eagerloader._aliasize_orderby make usage of improved list processing on
above.
- query.compile, within the "nested select generate" step processes the order_by clause using
the ClauseAdapter instead of Aliasizer since there is only one "target"
Diffstat (limited to 'lib/sqlalchemy/util.py')
-rw-r--r-- | lib/sqlalchemy/util.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/sqlalchemy/util.py b/lib/sqlalchemy/util.py index 54b1afa9f..c2e0dbc45 100644 --- a/lib/sqlalchemy/util.py +++ b/lib/sqlalchemy/util.py @@ -35,6 +35,16 @@ def to_set(x): else: return x +def flatten_iterator(x): + """given an iterator of which further sub-elements may also be iterators, + flatten the sub-elements into a single iterator.""" + for elem in x: + if hasattr(elem, '__iter__'): + for y in flatten_iterator(elem): + yield y + else: + yield elem + def reversed(seq): try: return __builtin__.reversed(seq) |