I have completed my idea of integration of SQLALchemy in a WSGI environ, in my wsgix framework.
wsgix (http://hg.mperillo.ath.cx/wsgix) is a WSGI framework whose main design goal it to provide a low level but flexible layer over WSGI. Since WSGI is mainly a functional API, wsgix is the same: a collection of functions that explicitly use the WSGI environ to keep state (and also configuration options). The integration with SQLALchemy is in wsgix.dbapi (http://hg.mperillo.ath.cx/wsgix/file/tip/wsgix/dbapi/__init__.py). The integration consist only of two pair of functions: contextual_connect(environ, engine) close_contextual_connection(environ, engine) and scoped_session(environ, session_factory) close_scoped_session(environ) These functions use the WSGI environ dictionary to keep the state, and a reference count is used to make sure resources are closed when no more needed. There are also some high level wrappers around contextual_connect. An example of high level wrapper around scoped_session can be found instead in the test suite (since I'm not sure about the best patterns for advanced session usage): http://hg.mperillo.ath.cx/wsgix/file/tip/wsgix/test/dbapi/test_dbapi.py I would really appreciate comments about the code. Thanks Manlio Perillo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---