On Jun 24, 2011, at 2:51 PM, Tarek Ziadé wrote:

> On Fri, Jun 24, 2011 at 7:04 PM, Michael Bayer <mike...@zzzcomputing.com> 
> wrote:
> ...
>>> Is there a way to do it with the existing pools ?   If not, I guess
>>> I'll work on a custom Pool,
>> 
>> well a pool is geared towards one specific connection which already has a 
>> "database" set up on it.    I guess maybe you'd use pool events to switch 
>> the "database" on checkout.
> 
> do you known if the switching can be done without closing the socket ?

yeah this is not a problem, if this is PG there's a default schema setting, i 
forget what it's called, with MySQL its "use".

Also, I realized that if you set up the Pool on all the Engines at once before 
any connections occur, the "on first connect" event will get called for all of 
them, so you could get it to work that way.


> 
>> 
>> You can share a pool between engines using the "pool" argument to 
>> create_engine(), but one problem with that right now is that the dialect 
>> which is per-engine uses the "on first checkout" event to handle some 
>> important dialect initialization.  That step would have to be accommodated 
>> in some way.
>> 
>> Also this solution is only local to one Python process, not even a fork.  
>> You might have a simpler time limiting TCP connections using a product like 
>> PGBouncer, and turn pooling way down or off for each SQLAlchemy pool, that 
>> way you can truly limit connections per host.
> 
> Ok thanks for the tip I'll investigate on this
> 
> Cheers
> Tarek
> 
> -- 
> 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 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to