[Zope-dev] Re: zope.sqlalchemy

Laurence Rowe l at lrowe.co.uk
Wed May 7 17:40:51 EDT 2008


Laurence Rowe wrote:
> Martijn Faassen wrote:
>> Hey Laurence,
>>
>> Laurence Rowe wrote:
>> [snip]
>>> We'll have to stick with scoped sesssions because of threading, but 
>>> the engine as local utility pattern should still work.
>>>
>>> #myapplication/__init__.py
>>> Session = 
>>> scoped_session(sessionmaker(bind=LookupEngine('my-engine')...))
>>> engine = EngineUtility(url='sqlite:///')
>>> provideUtility(engine, IConnectable, 'my-engine') # but normally a 
>>> local utility registration
>>>
>>> #myapplication/foo.py
>>> from myapplication import Session
>>> session = Session()

Would session = ISession(context) be a reasonable way for grok to handle 
this?

Making transactions span multiple instances of a single app seems 
impossible otherwise, though maybe that is an edge case that need not be 
supported.

Laurence



More information about the Zope-Dev mailing list