relationships to an inheriting mapper (which is also self-referential)
- reduced bind param size in query._get to appease the picky oracle
[ticket:244]
-- added 'checkfirst' argument to table.create()/table.drop()
+- added 'checkfirst' argument to table.create()/table.drop(), as
+well as table.exists() [ticket:234]
0.2.5
- fixed endless loop bug in select_by(), if the traversal hit
this does not issue a SQL DROP statement."""
key = _get_table_key(self.name, self.schema)
del self.metadata.tables[key]
+
+ def exists(self, engine=None):
+ if engine is None and self.metadata.is_bound():
+ engine = self.engine
+
+ def do(conn):
+ e = conn.engine
+ return e.dialect.has_table(conn, self.name)
+ return engine.run_callable(do)
+
def create(self, connectable=None, checkfirst=False):
if connectable is not None:
connectable.create(self, checkfirst=checkfirst)
Column('col1', Integer, primary_key=True),
Column('col2', String(40)))
try:
+ assert not table.exists()
table.create()
+ assert table.exists()
table.create(checkfirst=True)
table.drop()
table.drop(checkfirst=True)
+ assert not table.exists()
table.create(checkfirst=True)
table.drop()
finally: