In a pyramid application:
In models.py: DBSession=
scoped_session(sessionmaker(extensions=ZopeTransactionExtension()))
In view: dbsession = DBSession
def add(request):
#get implant1
dbsession.add(implant)
transaction.commit()
dbsession = DBsession
This works fine on first add. On second call to add, the first implant
object is updated rather than an object added as I would expect from the
sqlalchemy session docs . Using a new session after the commit is
suggested in the zope-sqlalchemy docs to achieve this. The user in this
application might do repeated adds into many tables in one request .
So because I want to use more than one session per request, I should not
use Zope-SQLAlchemy extension but SQLAlchemy ScopedSession helper class.
Is that correct? Please excuse any misuse of terminology. Thanks for
pointing me in the right direction.
Using SQLAlchemy0.7.3
zope-sqlalchemy0.6.1
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sqlalchemy/-/hKTt7MhHjEsJ.
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.