hi mike, I tried ThreadLocalMetaData() with similar results (primarily 'This Connection is closed' and 'This transaction is inactive'). we do a mix of session.connection style queries and ORM queries and we can't really change this over night :P. is there anything else I can try?
On Jun 2, 6:09 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: > It's the Metadata.bind(). MetaData doesn't scope out the bound engine > on a thread-local basis; we generally recommend that you perform ad- > hoc executions of SQL through session.execute() so that the current > Session is the single point of all access to the current connection/ > transactional context. There *is* a version of MetaData called > "ThreadLocalMetaData" which would eliminate the threading issues > you're having, but it still is better for you to stick with the single > point of execution so that all executions are on the current > transaction. > > On Jun 2, 2008, at 8:34 PM, arashf wrote: > > > > > I tried the example in the pylons docs. I'll post my base.py, model.py > > code here: > >http://pastebin.com/m1b47b4aa > > > thanks again for your help. also, is there a lower latency way I can > > catch a hold of you today? irc perhaps? :) > > > On Jun 2, 7:49 am, Michael Bayer <[EMAIL PROTECTED]> wrote: > >> On Jun 2, 2008, at 5:11 AM, arashf wrote: > > >>> that sounds perfect. unfortunately, I tried this in production and > >>> am > >>> getting sporadic exceptions that looks like this (i've never gotten > >>> these before): > > >>> WebApp Error: <class 'sqlalchemy.exceptions.OperationalError'>: > >>> (OperationalError) (2013, 'Lost connection to MySQL server during > >>> query') > > >>> WebApp Error: <class 'sqlalchemy.exceptions.ProgrammingError'>: > >>> (ProgrammingError) (2014, "Commands out of sync; you can't run this > >>> command now") > > >>> WebApp Error: <class 'sqlalchemy.exceptions.InvalidRequestError'>: > >>> This Connection is closed > > >>> any ideas? > > >> my initial guess is that you're sharing a connection between threads. > > >> what specifically is "this" ? the recipe in the Pylons tutorial ? > >> or > >> the threadlocal pool ? I really think you should go with what the > >> pylons tutorial has to say. SingletonThreadPool is not widely used > >> with MySQL so I'm not sure if there are caveats surrounding its usage > >> in that regard (though it has been used successfully). --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
