Hi.
I'm writing my own framework based on WSGI (and somehow on Nginx mod_wsgi):
http://hg.mperillo.ath.cx/wsgix
I want to implement the "best" possible integration with SQLAlchemy.
SQLAlchemy already implements all I need, the only problem is that for
proper functioning of some features (like emulated nested transaction),
it needs to use a threadlocal storage.
This is bad, since in Nginx we can have multiple concurrent connections
per thread (using psycopg2 extension for asynchronous queries).
I'm thinking to add a function:
# XXX add support for additional parameters like close_with_result?
def contextual_connect(environ, engine):
connection = environ.get('wsgix.dbapi.contextual_connection')
if connection is None:
connection = engine.connect()
environ['wsgix.dbapi.contextual_connection'] = connection
return connection
Using this function I can do:
connection = contextual_connect(environ, engine)
engine.transaction(callable, connection, *args, **kwargs)
and so on, perhaps implementing some convenient wrappers.
Moreover I plan to write a "pseudo" middleware that will take care of
proper cleanup of the contextual connection at the end of the request.
My question is: will this suffice or should I implement something more
integrated with SQLAlchemy?
Another problem is with the ORM, but I'm still studing it since a lot
has changed since last time I have used it.
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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---