[Zope3-Users] z3c.zalchemy - which version to use?

Hermann Himmelbauer dusty at qwer.tk
Thu May 8 03:24:29 EDT 2008


Am Mittwoch, 7. Mai 2008 17:43 schrieb Christian Theune:
> On Wed, May 07, 2008 at 03:41:11PM +0200, Hermann Himmelbauer wrote:
> > Hi,
> > I'd like to know if / which SVN version/branch of z3c.zalchemy works with
> > a current SQLAlchemy distribution.
> >
> > If none does, what about z3c.sqlalchemy?
>
> In addition to what Andreas said: zalchemy is going to be abandoned.
> zope.sqlalchemy will be the common base implementation of transaction
> integration with SQLAlchemy. Other packages like z3c.sqlalchemy will
> implement higher level functions in addition to that.

Ah, interesting, I was not aware of the existence of zope.sqlalchemy. Thanks 
to everyone who created the package, this simplifies things a lot. Will the 
package be contributed with Zope3 itself in the future, as it is in 
the "zope." namespace?

I just have a look at it and it looks fairly simple. What I don't understand 
ist, how/when the Session class should be created:

>>> Session = scoped_session(sessionmaker(
...                                 bind=engine,  
...                                 twophase=TEST_TWOPHASE, 
...                                 transactional=True, autoflush=True,
...                                 extension=ZopeTransactionExtension()))

Can I simply put this statement in one of my modules and import the Session 
class from other modules? This would create the Session class once during 
Zope startup. Does this mean that I don't need a utility anymore, such as in 
z3c.zalchemy?
Or do I have to create the Session class in each thread, e.g. in my code?

Best Regards,
Hermann

-- 
hermann at qwer.tk
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7


More information about the Zope3-users mailing list