On Feb 25, 2012, at 6:57 AM, lars van gemerden wrote:

> Hi all,
> 
> I looking for a way to delete/empty a sqlite database completely (can
> be in memory or file). I have tried:
> 
> - metadata.drop_all(engine); which does not work with cyclic
> references
> 

The cycles here are only between the ForeignKey objects themselves, in Python.  
 SQLite doesn't care.   Add the use_alter=True flag to each ForeignKey in a 
cycle.


> - solution from 
> http://www.sqlalchemy.org/trac/wiki/UsageRecipes/DropEverything;
> it requires names of foreign key columns to be returned by the
> inspector class, however these names are empty

are you using "PRAGMA foreign_keys = ON" ?      I've run this recipe with that 
flag on and off and while it doesn't get the foreign key constraints 
explicitly, it still drops all the tables just fine.    Perhaps I'm not 
actually achieving the "foreign_keys=ON" part since SQLite still lets me drop a 
table that others are dependent on.


-- 
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.

Reply via email to