Drop tables in depedency order, in an iteration:
http://docs.sqlalchemy.org/en/latest/core/metadata.html#sqlalchemy.schema.MetaData.sorted_tables



On Friday, August 14, 2015 at 2:16:33 PM UTC-7, Alex Waters wrote:
>
> I looked into the flask alchemy codebase and it doesn't look like there's 
> support. Unfortunately the only way I see of accomplishing this with mysql 
> is something like:
>
> SET FOREIGN_KEY_CHECKS = 0;
> DROP TABLE 'spam'.'eggs';
> SET FOREIGN_KEY_CHECKS = 1;
>
> so building that into drop_table() would be kludgey. 
>
> sqlalchemy does not seem to support the idea either: 
> http://docs.sqlalchemy.org/en/rel_1_0/core/metadata.html?highlight=drop#sqlalchemy.schema.MetaData.drop_all
>
> :/
>
> On Friday, August 7, 2015 at 6:14:18 PM UTC-4, [email protected] wrote:
>>
>> Does anyone know of an easy way to do db.drop_all() and ignore foreign 
>> keys using flask mysqlalchemy?
>>
>> I always get foreign key errors when I try to do this (I often drop all 
>> and create all when working on my models). I'm sure I could write a script 
>> to step through each table and drop their dependencies first, but I 
>> imagined there's probably an easier way.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pocoo-libs.
For more options, visit https://groups.google.com/d/optout.

Reply via email to