summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/ddl.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-11-20 11:03:01 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2012-11-20 11:03:01 -0500
commitfe8f8349c9f46abe37cd9de7876df0eeb5e12c94 (patch)
tree29b6b1f953d24f4b49a84069f13f3ef72e594212 /lib/sqlalchemy/engine/ddl.py
parent2799a674038bef5a81102935ae43c70163f0c556 (diff)
parentead37e4ec0dd5750769226befea043d9527f869e (diff)
downloadsqlalchemy-fe8f8349c9f46abe37cd9de7876df0eeb5e12c94.tar.gz
- an enormous merge just because I committed a one line log entry. the joy of DVCS
Diffstat (limited to 'lib/sqlalchemy/engine/ddl.py')
-rw-r--r--lib/sqlalchemy/engine/ddl.py39
1 files changed, 25 insertions, 14 deletions
diff --git a/lib/sqlalchemy/engine/ddl.py b/lib/sqlalchemy/engine/ddl.py
index f95e549b0..8da678525 100644
--- a/lib/sqlalchemy/engine/ddl.py
+++ b/lib/sqlalchemy/engine/ddl.py
@@ -14,8 +14,11 @@ class DDLBase(schema.SchemaVisitor):
def __init__(self, connection):
self.connection = connection
+
class SchemaGenerator(DDLBase):
- def __init__(self, dialect, connection, checkfirst=False, tables=None, **kwargs):
+
+ def __init__(self, dialect, connection, checkfirst=False,
+ tables=None, **kwargs):
super(SchemaGenerator, self).__init__(connection, **kwargs)
self.checkfirst = checkfirst
self.tables = tables and set(tables) or None
@@ -103,7 +106,9 @@ class SchemaGenerator(DDLBase):
class SchemaDropper(DDLBase):
- def __init__(self, dialect, connection, checkfirst=False, tables=None, **kwargs):
+
+ def __init__(self, dialect, connection, checkfirst=False,
+ tables=None, **kwargs):
super(SchemaDropper, self).__init__(connection, **kwargs)
self.checkfirst = checkfirst
self.tables = tables
@@ -116,15 +121,22 @@ class SchemaDropper(DDLBase):
tables = self.tables
else:
tables = metadata.tables.values()
- collection = [t for t in reversed(sql_util.sort_tables(tables))
- if self._can_drop_table(t)]
- seq_coll = [s for s in metadata._sequences.values()
- if s.column is None and self._can_drop_sequence(s)]
- metadata.dispatch.before_drop(metadata, self.connection,
- tables=collection,
- checkfirst=self.checkfirst,
- _ddl_runner=self)
+ collection = [
+ t
+ for t in reversed(sql_util.sort_tables(tables))
+ if self._can_drop_table(t)
+ ]
+
+ seq_coll = [
+ s
+ for s in metadata._sequences.values()
+ if s.column is None and self._can_drop_sequence(s)
+ ]
+
+ metadata.dispatch.before_drop(
+ metadata, self.connection, tables=collection,
+ checkfirst=self.checkfirst, _ddl_runner=self)
for table in collection:
self.traverse_single(table, drop_ok=True)
@@ -132,10 +144,9 @@ class SchemaDropper(DDLBase):
for seq in seq_coll:
self.traverse_single(seq, drop_ok=True)
- metadata.dispatch.after_drop(metadata, self.connection,
- tables=collection,
- checkfirst=self.checkfirst,
- _ddl_runner=self)
+ metadata.dispatch.after_drop(
+ metadata, self.connection, tables=collection,
+ checkfirst=self.checkfirst, _ddl_runner=self)
def _can_drop_table(self, table):
self.dialect.validate_identifier(table.name)