[Sqlalchemy-tickets] Issue #3569: Make MetaData.drop_all() work with foreign keys (zzzeek/sqlalchem
Brought to you by:
zzzeek
|
From: Roman Z. <iss...@bi...> - 2015-10-28 15:46:22
|
New issue 3569: Make MetaData.drop_all() work with foreign keys https://bitbucket.org/zzzeek/sqlalchemy/issues/3569/make-metadatadrop_all-work-with-foreign Roman Zimmermann: Currently issuing a drop_all() for PostgreSQL databases sometimes leads to a foreign key error like: ``` sqlalchemy.exc.InternalError: (psycopg2.InternalError) cannot drop table users because other objects depend on it DETAIL: constraint engaging_networks_tokens_user_id_fkey on table engaging_networks_tokens depends on table users HINT: Use DROP ... CASCADE to drop the dependent objects too. [SQL: '\nDROP TABLE users'] ``` This is a major nuissance since drop_all() is commonly used for testing. A workaround is documented in [this blogpost](http://www.mbeckler.org/blog/?p=218). |