diff options
Diffstat (limited to 'lib/sqlalchemy/schema.py')
-rw-r--r-- | lib/sqlalchemy/schema.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/sqlalchemy/schema.py b/lib/sqlalchemy/schema.py index 0e03be686..4e4468a85 100644 --- a/lib/sqlalchemy/schema.py +++ b/lib/sqlalchemy/schema.py @@ -405,15 +405,23 @@ class Table(SchemaItem, expression.TableClause): """Issue a ``CREATE`` statement for this table. See also ``metadata.create_all()``. + """ - self.metadata.create_all(bind=bind, checkfirst=checkfirst, tables=[self]) + + if bind is None: + bind = _bind_or_error(self) + bind.create(self, checkfirst=checkfirst) def drop(self, bind=None, checkfirst=False): """Issue a ``DROP`` statement for this table. See also ``metadata.drop_all()``. + """ - self.metadata.drop_all(bind=bind, checkfirst=checkfirst, tables=[self]) + if bind is None: + bind = _bind_or_error(self) + bind.drop(self, checkfirst=checkfirst) + def tometadata(self, metadata, schema=RETAIN_SCHEMA): """Return a copy of this ``Table`` associated with a different ``MetaData``.""" |