On Dec 9, 2009, at 6:56 PM, Peter wrote: > Hi > > I am sorry I misinterpreted the error message that I mentioned in my > previous mail: > > InvalidRequestError: Table 'accounts' is already defined for this > MetaData instance. Specify 'useexisting=True' to redefine options and > columns on an existing Table object. > > Apparently, the error is not raised by the mapper command , but by the > Table creation command : > > accounts_table = Table('accounts', metadata, > Column('guid', String(36), > autoload=False ) > > So how do I get rid of the Table instances ( without dropping the tables > in the database ) ? > > > I tried this one: > > for table in metadata.sorted_tables: > metadata.remove(table) > > but same problem.
easiest is to start with a new MetaData object, or call clear() on the MetaData() you have. Surgically removing individual tables from a MetaData is not really supported since it would involve removing related foreign key information on other Table objects (and there's not much use for such a feature). -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@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.