[sqlalchemy] sorting a list of tables from a database based on their dependency order

2011-07-11 Thread Tony
I'm doing this: sengine = create_enging(blah..blah) smeta = MetaData(bind=sengine) meta.reflect(sengine) tables = smeta.tables.keys() to get a list of tables in a database, but unfortunately the table list are not in their dependency order. For example: A is depending on B (has

Re: [sqlalchemy] sorting a list of tables from a database based on their dependency order

2011-07-11 Thread Conor
On 07/11/2011 02:37 PM, Tony wrote: I'm doing this: sengine = create_enging(blah..blah) smeta = MetaData(bind=sengine) meta.reflect(sengine) tables = smeta.tables.keys() to get a list of tables in a database, but unfortunately the table list are not in their dependency