1. You probably shouldn't use a global sqlalchemy session like that.  It is 
the cause of many developer's problems. There should probably be a ticket 
to remove/update that howto, so it references the current cookiecutter -- 
which stashes the session onto the request. 

2. pyramid_tm doesn't close/remove the session when finished.  if you look 
at the code, it doesn't touch sqlalchemy at all.  it just integrates 
zope.transaction's hooks with pyramid.  the sqlalchemy hookup is handled by 
passing in the zope_sqlalchemy's extension -- which handles all the hooks 
if sqlalchemy is used.  That package is using `session.close()` not 
`session.remove()`, because 'remove' is specific to scoped sessions (and 
the package supports regular sessions as well) . 

tldr; pyramid_tm is a bad place to handle this sort of thing, because there 
are multiple database backends (sqlalchemy, zope) and multiple session 
types (scoped, explicit).

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/6fba4f55-824e-4a31-ae63-409caaa8563a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to