Michael Bayer ha scritto: > About integrating SQLAlchemy in WSGI with a per request scoped > session.
> [...] > Current integration approaches focus on the scoped_session() construct > as "home base" for the current transaction. This is an adaption of > 0.3's "SessionContext", and the idea is the same; it receives a > "scopefunc" which can return any token you like that identifies the > current "context". By default, it returns the current thread > identifier, but you can change it to examine other resources to get at > the WSGI environ or similar. This is not possible. How should I get the WSGI environ? It MUST be passed explicitly. NOTE: in theory using greenlets, one always knows the current greenlet, so you can have something like greenlet local storage, but I would like to avoid this, and always explicitly pass the environ. > When using ORM session, the automatic > "nesting of begin/commit" behavior is available if you set autocommit > to True to start with, then use "begin()/commit()" pairs, sending the > flag "subtransactions=True" to allow subtransactions. I'm not sure if > your scheme overall calls for that. > For now its not a problem. Lately I tend to avoid the use of the ORM, I will think about this in future. > I think the method you're using with an individual connection would > work fine as well - the begin() method on connection also nests > itself with a "subtransaction" when called multiple times. > Yes, this is what I want. > Obviously, if multiple requests occur async in a single thread, you > have to ensure the connection pool is sized appropriately otherwise > your whole app could freeze if an async request blocks on no > connections available. > If no connections are available, then an exception should be raised. 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 -~----------~----~----~----~------~----~------~--~---