On Thu, Jun 6, 2013 at 7:20 PM, Christoph Zwerschke <[email protected]> wrote:

> Am 06.06.2013 17:55, schrieb Martin Thorsen Ranang:
>
>  When I try to run this inside a "paster shell development.ini", the
>> SQLAlchemy log even reports:
>>  >>> DBSession.execute(d)
>> 17:31:15,903 INFO  [sqlalchemy.engine.base.**Engine] DELETE FROM
>> tg_user_group WHERE tg_user_group.user_id = ? AND tg_user_group.group_id
>> = ?
>> 17:31:15,903 INFO  [sqlalchemy.engine.base.**Engine] (1, 1)
>>
>
> But the log doesn't report a COMMIT, right?
>

Of course, you're right.  I'm sorry I forgot to report that explicitly.


>  And, just to make sure, I can assert that I have no similar problems
>> when doing SQLAlchemy operations on ORM-mapped instances.
>>
>
> I think the problem is that you need to explicitly set the transaction
> into a changed state if you're not going through the ORM.
>
> Try to do this before calling transaction.commit():
>
> from zope.sqlalchemy import mark_changed
> mark_changed(DBSession())
>

Thank you very much, Christoph.  That made the difference.  And, adding the
mark_changed() call also made a similar insert operation work correctly.

-- 
Kind regards,

Martin Thorsen Ranang, Ph.D.
CTO of OnLive Research AS
Skype: mtranang
http://no.linkedin.com/in/ranang

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to