Ezio Vernacotola wrote:
> I need a database connection pool that can reconnect to a different
> replicated failover server if the main server stop working. I found
> DButil SteadyDBConnection works great in transparently reconnect if the
> connection is lost, but to try a different server I'm trying some
> changes that incorporate some ideas from sqlalchemy pool.py.
>
> Instead of pass as first arg of SteadyDBConnection a dbapi module should
> be possible also pass a callable function that must return a newly
> connected DBAPI connection object as in this example:
>
> ######
> from DBUtils.PersistentDB import PersistentDB
> import kinterbasdb
>
> def getconn():
> try:
> conn = kinterbasdb.connect(dsn=dsn1,...)
> except kinterbasdb.OperationalError:
> conn = kinterbasdb.connect(dsn=dsn2, ...)
> return conn
>
> persist = PersistentDB(getconn)
> ######
>
> In the callable function we can implement also other nice things as load
> balancing.
I thought that was a good idea; just wanted to let you know that it is
now implemented in DBUtils 0.9.3.
-- Chris
|