[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

[sqlalchemy] with_comment() ?

2011-07-11 Thread Tarek Ziadé
Hello We're using with_hint() to add comments to sql queries, but that'll be work only with selects. I guess I can do a compiler extension to be able to add a /* comment */ in my queries, but I was wondering: unless I missed something, wouldn't it be useful to have a with_comment() method to be

Re: [sqlalchemy] hybrid, relationships and inheritance.

2011-07-11 Thread James Studdart
Hi Michael, thanks for your reply. I did get it working with the @property/hybrid_property, but it turns out what I really needed was a custom collection class. At least, that seems to be working in a cleaner fashion. I'm still fumbling around in the dark a little bit, so we'll see how it

[sqlalchemy] Can't get sqlalchemy to backup or restore MSSQL database

2011-07-11 Thread Maciej Filip Szkodziński
Hello, I'm trying to backup a database running on SQL Server 2008 Express. I'm using pyodbc as the driver. This backup code executes happily, however no file is written to the provided path. I've also tried placing an empty file in the path, and only 2KB of data gets written to it. eng =

[sqlalchemy] Re: Can't get sqlalchemy to backup or restore MSSQL database

2011-07-11 Thread Eric Ongerth
I think more common practice is just to use shell scripts (whether in scheduled tasks / cron jobs or manually) for backup. But I don't know MSSQL specifically. I just have rarely heard of anyone trying to accomplish their backup with SQLAlchemy as part of the chain of command. On Jul 11, 2:06