agesys-dev team mailing list archive
-
agesys-dev team
-
Mailing list archive
-
Message #00084
[Bug 906183] Re: SQLAlchemy + oursql Connection Timeout Issue
i tried using another mysql driver (mysqldb) to rule out any potential
issues with SQLAlchemy and found that the latest version of that
exhibits the same behavior. upon realizing this, i started to look into
my code and found that SQLAlchemy runs with autocommit=False, which
means that you must commit (and close) your connections so i was holding
onto connections continuously. setting this to true, each query would
result in committing and returning the connection to the pool.
please close this bug.
--
You received this bug notification because you are a member of Agesys
Team, which is subscribed to oursql.
https://bugs.launchpad.net/bugs/906183
Title:
SQLAlchemy + oursql Connection Timeout Issue
Status in oursql:
New
Bug description:
i'm running into the MySQL timeout issue (MySQL server has gone away)
using oursql in conjunction with SQLAlchemy. from the SQLAlchemy
documentation:
Connection Timeout
MySQL features an automatic connection close behavior, for connections
that have been idle for eight hours or more. To circumvent having this
issue, use the pool_recycle option which controls the maximum age of
any connection.
My application is a web application where i hold onto connections
persistently and i've added the pool_recycle option as suggested by
sqlalchemy, but wondering if somehow this is not being recognized by
oursql. i have yet to look into any of the SQLAlchemy code to see if
what i imagine them to be doing is testing their connections
periodically to essentially keep it alive.
env:
Python = 2.7.1
SQLAlchemy = 0.7.3
oursql = 0.9.3
MySQL = 5.1.58
Linux = 2.6.x (64 bit)
here's a snippet of my python code, sorry I canot provide a runnable
reproducer at the moment:
conn_str = driver + 'mysql+oursql://' + user + ':' + password + '@' + host + ':' + \
str(port) + '/' + db
self.engine = sqlalchemy.create_engine( conn_str, echo=False, pool_recycle=3600 ) # number of seconds for a connection
self.metadata = sqlalchemy.MetaData(bind=self.engine)
self.connection = self.engine.connect()
self.Session = sqlalchemy.orm.sessionmaker(bind=self.engine)
self.session = self.Session()
To manage notifications about this bug go to:
https://bugs.launchpad.net/oursql/+bug/906183/+subscriptions
References