Re: [Zope-dev] SQLAlchemy integration experiment

2008-06-17 Thread Brian Sutherland
On Mon, Jun 16, 2008 at 08:40:24PM +0200, Martijn Faassen wrote: Hi there, In some earlier discussions a number of approaches to integrate SQLAlchemy into Zope were discussed. Following up on that, I've tried a particular approach that tries to use ScopedSessions with a custom scope that

[Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Martin Aspeli
Brian Sutherland wrote: On Mon, Jun 16, 2008 at 08:40:24PM +0200, Martijn Faassen wrote: Hi there, In some earlier discussions a number of approaches to integrate SQLAlchemy into Zope were discussed. Following up on that, I've tried a particular approach that tries to use ScopedSessions with

[Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Martijn Faassen
Brian Sutherland wrote: On Mon, Jun 16, 2008 at 08:40:24PM +0200, Martijn Faassen wrote: [snip] from z3c.sa_integration import Session ... def somewhere_in_a_view(self): session = Session() return session.query(Test).all() For some reason this raises a warning bell in my head. I

[Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Martijn Faassen
Martin Aspeli wrote: Brian Sutherland wrote: [snip] For some reason this raises a warning bell in my head. I keep on thinking: this is zope, the session is a classic case for a utility, we should be getting it in views by an interface. FWIW, I had the same though. I think there's a

[Zope-dev] Zope Tests: 5 OK

2008-06-17 Thread Zope Tests Summarizer
Summary of messages to the zope-tests list. Period Mon Jun 16 11:00:00 2008 UTC to Tue Jun 17 11:00:00 2008 UTC. There were 5 messages: 5 from Zope Tests. Tests passed OK --- Subject: OK : Zope-2.8 Python-2.3.6 : Linux From: Zope Tests Date: Mon Jun 16 20:55:01 EDT 2008 URL:

Re: [Zope-dev] Re: [Checkins] SVN: zope.app.container/trunk/src/zope/app/container/browser/adding.py 1 include per line

2008-06-17 Thread Benji York
On Mon, Jun 16, 2008 at 8:23 AM, Christophe Combelles [EMAIL PROTECTED] wrote: Benji York a écrit : On Mon, Jun 16, 2008 at 4:42 AM, Christophe Combelles [EMAIL PROTECTED] wrote: Log message for revision 87419: 1 include per line Why's that? Not extremely important, but it's better for

Re: [Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Brian Sutherland
On Tue, Jun 17, 2008 at 11:52:49AM +0200, Martijn Faassen wrote: However, Laurence's point about database re-connection is relevant here. If the Session were looked up by an interface, someone could implement seamless database re-connection (lots of complex code) without polluting

Re: [Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Martijn Faassen
Hi there, On Tue, Jun 17, 2008 at 2:30 PM, Brian Sutherland [EMAIL PROTECTED] wrote: [snip] Just commenting that IDatabase.engine is not used by any code external to the Database object. There's no use case for it to be public. While I am not sure we have a strong use case for engine anyway, I

Re: [Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Brian Sutherland
On Tue, Jun 17, 2008 at 11:58:56AM +0200, Martijn Faassen wrote: Anyway, the balance can come out somewhere else. People are free to write their own integration approaches, it's just that mine is actually about trying to make exactly this pattern work in the first place. Then when I

Re: [Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Martijn Faassen
Hi there, Just as some context: I'm not proposing to extend zope.sqlalchemy at all. I'm proposing to write an extension that has the configuration pattern I sketched out. I also don't intend to write the last SQLAlchemy integration layer; I wouldn't be so presumptious. :) That said, if we can

[Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Laurence Rowe
Martijn Faassen wrote: Hi there, On Tue, Jun 17, 2008 at 2:30 PM, Brian Sutherland [EMAIL PROTECTED] wrote: [snip] Just commenting that IDatabase.engine is not used by any code external to the Database object. There's no use case for it to be public. While I am not sure we have a strong use

[Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Martijn Faassen
Hey Laurence, Laurence Rowe wrote: [snip] I'm not sure connection pooling is really useful in a threaded environment with recycled sessions. You want n threads = n connections. If we started creating new sessions each request then things would be different. Mike Bayer says the following:

Re: [Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Brian Sutherland
On Tue, Jun 17, 2008 at 05:25:56PM +0200, Brian Sutherland wrote: class IDatabase(Interface): def scopefunc(): The scopefunc def session_factory(): The session factory def scopefunc(): util = component.getUtility(IDatabase) return

[Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Martijn Faassen
Brian Sutherland wrote: [snip] This would probably be close to what I would write for my usecase: class Database: implements(IDatabase) def __init__(self, *args, **kw): self._args = args self._kw = kw def scopefunc(self): return None # use default

[Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Martijn Faassen
Hey, [replying to myself] Martijn Faassen wrote: Laurence Rowe wrote: [snip] I'm not sure connection pooling is really useful in a threaded environment with recycled sessions. You want n threads = n connections. If we started creating new sessions each request then things would be

Re: [Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Laurence Rowe
2008/6/17 Michael Bayer [EMAIL PROTECTED]: On Jun 17, 2008, at 10:09 AM, Laurence Rowe wrote: I'm not sure connection pooling is really useful in a threaded environment with recycled sessions. You want n threads = n connections. If we started creating new sessions each request then things

Re: [Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Michael Bayer
On Jun 17, 2008, at 12:41 PM, Laurence Rowe wrote: What connection pooling is used by default? e.g. with create_engine('sqlite:///:memory:') sqlite is a special case, it uses the SingletonThreadPool. This pool holds onto one connection per thread.This is used in SQLite because of a

[Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Martijn Faassen
Hey, Michael Bayer wrote: [snip comments on connection pooling] Thanks for showing up here and participating in the discussion, Michael. To me it's clear we should try to reuse engines as much as we can. Regards, Martijn ___ Zope-Dev maillist -

[Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Martin Aspeli
Martijn Faassen wrote: Martin Aspeli wrote: Brian Sutherland wrote: [snip] For some reason this raises a warning bell in my head. I keep on thinking: this is zope, the session is a classic case for a utility, we should be getting it in views by an interface. FWIW, I had the same though. I

[Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Laurence Rowe
Martin Aspeli wrote: Martijn Faassen wrote: Martin Aspeli wrote: Brian Sutherland wrote: [snip] For some reason this raises a warning bell in my head. I keep on thinking: this is zope, the session is a classic case for a utility, we should be getting it in views by an interface. FWIW, I had

[Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Martin Aspeli
Laurence Rowe wrote: Martin Aspeli wrote: Martijn Faassen wrote: Martin Aspeli wrote: Brian Sutherland wrote: [snip] For some reason this raises a warning bell in my head. I keep on thinking: this is zope, the session is a classic case for a utility, we should be getting it in views by an

[Zope-dev] Re: SQLAlchemy integration experiment

2008-06-17 Thread Martijn Faassen
Martin Aspeli wrote: Martijn Faassen wrote: [snip] The Zope component architecture is not about seeing explicit calls into it everywhere. That's not the point of it. The point of it is about making applications more flexible by allowing people to plug in components. My approach allows you to

[Zope-dev] Re: [Checkins] SVN: zope.app.container/trunk/src/zope/app/container/browser/adding.py 1 include per line

2008-06-17 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Benji York wrote: On Mon, Jun 16, 2008 at 8:23 AM, Christophe Combelles [EMAIL PROTECTED] wrote: Benji York a écrit : On Mon, Jun 16, 2008 at 4:42 AM, Christophe Combelles [EMAIL PROTECTED] wrote: Log message for revision 87419: 1 include per