I'm writing a daemon that constantly manipulates a database, and needs to be able to keep chugging along if MySQL is restarted or becomes (dis/re)connected for some reason. I've been testing this behavior and I can't quite figure out how to make it consistently work.
I get repeated OperationalError('MySQL server has gone away') errors when I restart MySQL during execution and then try to run queries. Calling session.close() doesn't resolve the errors; I've found that only creating/using a new Engine seems to let it continue. This is probably because of connection pooling - I think SQLA is just pulling dead connections out of the pool and trying to use them. I feel like destroying the Engine is a little heavy-handed and that I should just be able to tell the pool "hey, all your connections aren't tied to the database any more; drop those and start pooling again please." What do you recommend? -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.