python - sqlalchemy mysql server has gone away -


i've read through number of similar problems, none seem fix issue. i'm running pylons app , using sqlalchemy connect 2 databases. primary, configured through config file works without issue. i'm trying connect second database initializing class defined in model so:

class db2(object):    def __init__(self):     self.engine = sa.create_engine('mysql://someaddress:3306/database', echo=false, pool_recycle=1800)     self.meta = sa.metadata(self.engine)      <define tables>      <define mappings>      session = orm.sessionmaker(bind=self.engine, autoflush=false, autocommit=false)     self.session = session() 

i thought defining pool_recycle there (with time matches working database) enough prevent this, it's not. can recommend solution? thanks.

i've had same problem recently, , solved ensuring closes transaction, after selects. add db2.session.commit() each place it, , should start cycling connections.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -