On Sun, Jan 26, 2014 at 10:55 PM, Johnny Rico <[email protected]>
wrote:
> You need to commit the transaction, you could turn autocommit on:
>
> DBSession = scoped_session(sessionmaker(autocommit=True,
> extension=ZopeTransactionExtension()))
>
This will probably trigger some exceptions because when using the
ZopeTransactionExtension it's not valid to use DBSession.commit() any
longer. The transaction must be managed via the transaction package.
When you are using the ZTE and pyramid_tm to manage your transactions, you
must tell the manager that the session's state is now dirty and needs to be
committed. This is done automatically when using the ORM, but is not
automated for arbitrary SQL queries because it cannot tell which ones
actually mutate state.
You can handle this in three different ways.
1) Manually commit the transaction using transaction.commit().
2) Mark the transaction as dirty using "from zope.sqlalchemy import
mark_changed" and then after your query, manually marking the session as
dirty via mark_changed(DBSession()).
3) Have zope.sqlalchemy always assume that the session has been changed by
defaulting to a dirty state using ZopeTransactionExtension('changed').
https://pypi.python.org/pypi/zope.sqlalchemy
- Michael
--
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].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/groups/opt_out.