summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-10-01 01:59:59 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-10-01 01:59:59 -0400
commit0bb5a9eab829f9a4cfda3c37cdf2202d84e55f3f (patch)
tree2e7847e098ac547b5907c6650e219e9b0a65236e /lib/sqlalchemy/sql
parenteaa15b3c70020b96aebd2e05651eb18226ff4ee3 (diff)
downloadsqlalchemy-0bb5a9eab829f9a4cfda3c37cdf2202d84e55f3f.tar.gz
- fix the fixture here that wasn't creating consistently
- rewrite --dropfirst to be more industrial strength, includes views - fix order_by="foreign_key" to maintain the same ordering as metadata.sorted_tables. Not ideal that this was the other way throughout 0.7 but this is still a little-used method, in contrast to metadata.sorted_tables.
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/compiler.py3
-rw-r--r--lib/sqlalchemy/sql/util.py7
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index bb1d757be..d3a4a64a2 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -1854,6 +1854,9 @@ class DDLCompiler(engine.Compiled):
def visit_drop_table(self, drop):
return "\nDROP TABLE " + self.preparer.format_table(drop.element)
+ def visit_drop_view(self, drop):
+ return "\nDROP VIEW " + self.preparer.format_table(drop.element)
+
def _index_identifier(self, ident):
if isinstance(ident, sql._truncated_label):
max = self.dialect.max_index_name_length or \
diff --git a/lib/sqlalchemy/sql/util.py b/lib/sqlalchemy/sql/util.py
index 70ea4c751..28c13398f 100644
--- a/lib/sqlalchemy/sql/util.py
+++ b/lib/sqlalchemy/sql/util.py
@@ -13,7 +13,8 @@ from collections import deque
"""Utility functions that build upon SQL and Schema constructs."""
def sort_tables(tables, skip_fn=None):
- """sort a collection of Table objects in order of their foreign-key dependency."""
+ """sort a collection of Table objects in order of
+ their foreign-key dependency."""
tables = list(tables)
tuples = []
@@ -30,8 +31,8 @@ def sort_tables(tables, skip_fn=None):
for table in tables:
visitors.traverse(table,
- {'schema_visitor':True},
- {'foreign_key':visit_foreign_key})
+ {'schema_visitor': True},
+ {'foreign_key': visit_foreign_key})
tuples.extend(
[parent, table] for parent in table._extra_dependencies