well the easiest is mytable.drop(engine, checkfirst=True). The "check" is not within the DropTable construct, which represents just the actual DROP TABLE statement. If you were using DropTable directly you'd call engine.has_table(tablename) first to check for it.
On Sep 28, 2011, at 8:07 AM, Chris Withers wrote: > Hi, > > Much less controversial question this time, I hope ;-) > > I have: > > class MyModel(Base) > ... > > I want to do: > > engine = create_engine(...) > engine.execute(DropTable(MyModel.__table__)) > engine.execute(CreateTable(MyModel.__table__)) > > ...of course, this barfs the first time I run it as the table doesn't exist. > > I was looking for something like: > > engine.execute(DropTable(MyModel.__table__, if_exist=True)) > > what's the "right" way to do this? > > Chris > > -- > Simplistix - Content Management, Batch Processing & Python Consulting > - http://www.simplistix.co.uk > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalchemy@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.