summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/ddl.py
diff options
context:
space:
mode:
authorDiana Clarke <diana.joan.clarke@gmail.com>2012-11-19 12:52:23 -0500
committerDiana Clarke <diana.joan.clarke@gmail.com>2012-11-19 12:52:23 -0500
commit34b8b22659999eae459ca33baa3ca479f8eb5bf1 (patch)
tree8612f22499c0bf4ec556dcdd31c2c3e276e83bc8 /lib/sqlalchemy/engine/ddl.py
parent0ac15d61f7a4b4b68cc4f1a63763823ee3c42d30 (diff)
downloadsqlalchemy-34b8b22659999eae459ca33baa3ca479f8eb5bf1.tar.gz
just a pep8 pass of lib/sqlalchemy/engine/
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)