title: How do I drop custom types using SQLAlchemy + PostgreSQL?
body: <p>I have a script which cleans the database, and this is widely used in our tests.</p>
  
  <p>First, we tried to use SQLAlchemy Metadata.drop_all() thing, but it didn't resolve some foreign keys on deletion, which caused errors. Then, I found <a href="https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/DropEverything" rel="nofollow">this script</a> from @zzzeek, which does almost the same, but in a "smart" way. It handles all the issues with foreign keys, but now there are several issues regarding changed custom types (ENUMs). The question is, how can I drop them all them using SQLAlchemy? Execute DROP TYPE by hand only?</p>
  
  <p>Tables in database are created with Alembic, and even while script above deletes all tables successfully, some custom ENUMs are still there and everything fails on attempt to recreate them.</p>
  
  <p>Recreating the whole database is not a preferred solution, because default DB user for application shouldn't normally have rights to create databases.</p>