summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/util.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2008-08-19 21:27:34 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2008-08-19 21:27:34 +0000
commit427ed1966f0f9ce13df49dcdbe43ce48333e94fa (patch)
tree20c34c3a838c37c73828473ea47e889c51f1fe8f /lib/sqlalchemy/sql/util.py
parent20c82967ca98ceead88401ca8f35f8cf0e758318 (diff)
downloadsqlalchemy-427ed1966f0f9ce13df49dcdbe43ce48333e94fa.tar.gz
- fixed a bug in declarative test which was looking for old version of history
- Added "sorted_tables" accessor to MetaData, which returns Table objects sorted in order of dependency as a list. This deprecates the MetaData.table_iterator() method. The "reverse=False" keyword argument has also been removed from util.sort_tables(); use the Python 'reversed' function to reverse the results. [ticket:1033]
Diffstat (limited to 'lib/sqlalchemy/sql/util.py')
-rw-r--r--lib/sqlalchemy/sql/util.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py
index ba6b5a605..e1636ccf9 100644
--- a/lib/sqlalchemy/sql/util.py
+++ b/lib/sqlalchemy/sql/util.py
@@ -4,7 +4,7 @@ from itertools import chain
"""Utility functions that build upon SQL and Schema constructs."""
-def sort_tables(tables, reverse=False):
+def sort_tables(tables):
"""sort a collection of Table objects in order of their foreign-key dependency."""
tuples = []
@@ -18,11 +18,7 @@ def sort_tables(tables, reverse=False):
for table in tables:
visitors.traverse(table, {'schema_visitor':True}, {'foreign_key':visit_foreign_key})
- sequence = topological.sort(tuples, tables)
- if reverse:
- return reversed(sequence)
- else:
- return sequence
+ return topological.sort(tuples, tables)
def search(clause, target):
if not clause: