What is the proper connection string for sqlalchemy to support pool_recycle?
Is there a setting in mod_Wsgi to support this?

sqlachemy.dburi="mysql://username:[EMAIL PROTECTED]:3306/databasename ??

I found the following :

http://www.sqlalchemy.org/trac/wiki/FAQ#MySQLserverhasgoneawaypsycopg.InterfaceError:connectionalreadyclosed
MySQL server has gone away / psycopg.InterfaceError?: connection
already closed ΒΆ

This is usually symptomatic of the database closing connections which
have been idle for some period of time. On MySQL, this defaults to
eight hours.

Use the pool_recycle setting on the create_engine() call, which is a
fixed number of seconds for which an underlying pooled connection will
be closed and then re-opened. Note that this recycling only occurs at
the point at which the connection is checked out from the pool;
meaning if you hold a connection checked out from the pool for a
duration greater than the timeout value, the timeout will not work.
(it should be noted that it is generally bad practice for a web
application to hold a single connection open globally; Connection
objects should be obtained via connect() and closed/removed from scope
as needed).

Note: With MySQLdb specifically, this error was also occuring due to
sloppy re-use of connections within SA's connection pool. As of SA
0.3.3 these issues have been fixed.



I'm trying to fix the following:
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115]   File
"/usr/lib/python2.4/site-packages/sqlalchemy/pool.py", line 128, in
get
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115]     return
self.do_get()
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115]   File
"/usr/lib/python2.4/site-packages/sqlalchemy/pool.py", line 362, in
do_get
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115]     return
self.create_connection()
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115]   File
"/usr/lib/python2.4/site-packages/sqlalchemy/pool.py", line 111, in
create_connection
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115]     return
_ConnectionRecord(self)
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115]   File
"/usr/lib/python2.4/site-packages/sqlalchemy/pool.py", line 149, in
__init__
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115]
self.connection = self.__connect()
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115]   File
"/usr/lib/python2.4/site-packages/sqlalchemy/pool.py", line 174, in
__connect
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115]
connection = self.__pool._creator()
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115]   File
"/usr/lib/python2.4/site-packages/sqlalchemy/engine/strategies.py",
line 57, in connect
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115]     raise
exceptions.DBAPIError("Connection failed", e)
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115] DBAPIError:
(Connection failed) (OperationalError) (2002, "Can't connect to local
MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115]     raise
exceptions.DBAPIError("Connection failed", e)
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115] DBAPIError:
(Connection failed) (OperationalError) (2002, "Can't connect to local
MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115]     raise
exceptions.DBAPIError("Connection failed", e)
[Mon Mar 03 17:34:01 2008] [error] [client 69.210.248.115] DBAPIError:
(Connection failed) (OperationalError) (2002, "Can't connect to local
MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")


Ideas?
Lucas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to