On Sun, May 30, 2010 at 6:20 PM, Lance Edgar <lance.ed...@gmail.com> wrote:
> On 5/30/2010 9:43 AM, Eric Lemoine wrote:
>>
>> On Sun, May 30, 2010 at 4:39 PM, Eric Lemoine
>> <eric.lemo...@camptocamp.com>  wrote:
>>
>>>
>>> Hello
>>>
>>> I use Pylons. Pylons does:
>>>
>>> Session = scoped_session(sessionmaker())
>>>
>>> and then:
>>>
>>> Session.configure(bind=engine)
>>>
>>> My question: with a reference to Session how can I get the engine
>>> that's bound to it? I tried Session.get_bind() but I get this error:
>>> "TypeError: get_bind() takes at least 2 arguments (1 given)".
>>>
>>
>> Session.get_bind(mapper=None) seems to do the trick, but I'm not sure
>> this is the good way. Could someone confirm? Thanks again.
>>
>
> Not sure if this is proper, but I've always just used Session.bind.  Then
> again I've really only used it when testing things out, because at runtime
> my engines are defined in such a way that I never need to "discover" them
> through the Session.

Thanks for your response. I just noticed that Pylons itself uses
Session.bind [*], so I guess it should be ok.

[*] 
<http://pylonshq.com/project/pylonshq/browser/pylons/templates/default_project/%2Bpackage%2B/websetup.py_tmpl#L21>


-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemo...@camptocamp.com
http://www.camptocamp.com

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