Re: [sqlalchemy] Re: How to (quick) check if a table exists in schema?

2012-04-25 Thread Michael Bayer
dialect has a has_table method: engine.dialect.has_table(engine.connect(), "mytable") On Apr 25, 2012, at 10:33 AM, Massi wrote: > Thank you for your reply Wichert, I already used the Inspector method > get_table_names(), but using that I'd have to check if a table name is > present in a vect

[sqlalchemy] Re: How to (quick) check if a table exists in schema?

2012-04-25 Thread Massi
Thank you for your reply Wichert, I already used the Inspector method get_table_names(), but using that I'd have to check if a table name is present in a vector which can have 100.000 elements. This can be even slower if done for lots of times. Maybe I can perform a binary search, but I'm not sure

Re: [sqlalchemy] How to (quick) check if a table exists in schema?

2012-04-25 Thread Wichert Akkerman
On 04/25/2012 03:57 PM, Massi wrote: Hi everyone, in my script I have to deal with a huge database with thousands of tables. Given a table name (a python string) I would have to now if such a table exists or not. Up to now I have written this function: def DBGetTableByName(table_name) :

[sqlalchemy] How to (quick) check if a table exists in schema?

2012-04-25 Thread Massi
Hi everyone, in my script I have to deal with a huge database with thousands of tables. Given a table name (a python string) I would have to now if such a table exists or not. Up to now I have written this function: def DBGetTableByName(table_name) : metadata = MetaData(engine) tr

Re: [sqlalchemy] Automatically merge a specific model/object

2012-04-25 Thread Torsten Landschoff
Hi all, sorry for pulling out this old thread again. I continuously run into this. Am 08/09/2010 11:20 PM, schrieb Michael Bayer: If I'm understanding correctly, that's not as much about merging as it is for the "unique object" recipe, which is this: http://www.sqlalchemy.org/trac/wiki/UsageRe

[sqlalchemy] Re: Rollback raises "connection already closed"

2012-04-25 Thread Wolfgang Schnerring
* Michael Bayer [2012-04-24 15:21]: > On Apr 24, 2012, at 3:12 AM, Wolfgang Schnerring wrote: >> So, if I understand you correctly, >> 1. sqlalchemy indeed detects disconnect situations on rollback >> 2. psycopg2 should signal those correctly >> 3. my synthetic test may not be appropriate >> >> R