On Wed, Nov 24, 2010 at 2:15 PM, Ben Bangert <b...@groovie.org> wrote:
> On Nov 24, 2010, at 1:49 PM, Mike Orr wrote:
>
>> So do we need multiple sessions? I'm not sure we've defined the use
>> cases clearly enough, which runs the risk that we'll make an API that
>> won't be adequate anyway. So I'm inclined to use a single session. We
>> can always add a multisession object later under a different name, and
>> share the default session with it.
>
> Indeed, I think to begin with, we can provide a single session you can 
> retrieve with:
>
> from pyramid_sqla import get_dbsession
> DBSession = get_dbsession()
>
> When you setup the db sessions with setup_dbsessions, you can provide 
> multiple engine configs if desired, and use get_engine to fetch it by the 
> name you called it.
>
>> If people are using the same ORM objects to copy data from one db to
>> another, I think they can use a 'bind' argument on the specific calls.
>
> Yup, so they would do that themselves after fetching the engine they want. I 
> think that keeps it pretty simple still and obvious that pyramid_sqla isn't 
> doing any magic, its just holding onto the engines that were setup, and can 
> bind an engine to a session during 'setup_dbsessions' if desired (ie, using 
> table reflection which requires them to be bound immediately).
>
> I unfortunately won't have time to crank this out before Monday as I'm 
> heading out later today for Thanksgiving. Given what I've said about its 
> proposed API though, maybe a quick prototype for the purposes of the tutorial 
> can be built by someone. Here's a quick Python mockup:
> http://pastie.org/1324151

Why a list of sessions? That doesn't seem to give much control over
which session you get.

-- 
Mike Orr <sluggos...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-de...@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to