My setup is that I've got a single authorization database that stores
connection information for hundreds and hundreds of other databases.
The system is a low bandwidth system since it is only used for real
time stats and not public facing.

I've been attempting to use SQLAlchemy with pool_recycle=0 and
pool_size=0 for the second meta and Session objects set up (the first
being the connection to the authorization database that I don't mind
being pooled).

in my controllers I'm putting the init_model() call in the
__before__() method.

here's an example:

class MyController(BaseController):
    def __before__(self,action,id):
        site_info_q = site_model.Session.query(site_model.Site)
        site_info = site_info_q.get(int(id))
        www_model.init_model('mysql://%s:%...@%s:3306/%s'%(\
            site_info.user,site_info.pass,
            site_info.host,site_info.name))

Needless to say it isn't working very well at all.  I'm consistently
getting the "MySQL Server has gone away" errors and am now getting
bizarre caching issues, for example, if i go to /action/1 and then
try /action/2, i will sometimes get results still from /action/1

My question is - how can i get SQLAlchemy and Pylons to force a new
connection to the database per controller load?

Let me know if I am being unclear at all, and if this is even
something SQLAlchemy should be used for.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to