On Oct 10, 2014, at 6:15 PM, Jonathan Vanasco <[email protected]> wrote:
> After reloading postgres's config, my web app had an error from a terminated > PostgreSQL connection. After hitting reload a few times, the situation > corrected itself ( there were multiple uwsgi workers with stale connections ). > > I started looking at the docs for dealing with disconnects ( > http://docs.sqlalchemy.org/en/latest/core/pooling.html#dealing-with-disconnects > ), specifically the 'Pessimistic' strategy, and that made me think -- would > it be possible (and preferable) to handle a pessimistic option with the > initial "BEGIN" transaction command ? it is very possible, I was doing this in openstack for a bit until folks revealed they were using non-transactional executions. You do the "select 1" inside the after_begin() event. as far as preferable, depends on what you're doing. if you're always using a transaction (like with a Session), then sure, it's probably more appropriate, but then again if you do it on checkout, it works out to more or less the same thing. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" 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 http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
