Wow, that was fast :) You are right, the commit() here finally performs the delete. However, the situation "main section" etc only arose in this script I compiled for testing. The project uses Pyramid where transaction.commit() is called automatically at the end of each request. And as I mentioned above, the same code (without explicit commit()) works fine for Role and Principal, just RoleMember sucks.
Good code from the controller for Principal @view_config(name='xhr_delete', context='pym:resources.System_UsrMgr_User', renderer='json') def xhr_delete(context, request): try: id = int(request.POST['id']) sess.query(_Entity).filter(_Entity.id==id).delete(synchronize_session=False) sess.flush() resp = { 'status': True, 'msg': 'Ok' } return resp except (StatementError, NoResultFound) as exc: resp = { 'status': False, 'msg': repr(exc), 'errors':{} } return resp Bad code from the controller for RoleMember: @view_config(name='xhr_delete', context='pym:resources.System_UsrMgr_RoleMember', renderer='json') def xhr_delete(context, request): try: id = int(request.POST['id']) sess.query(_Entity).filter(_Entity.id==id).delete(synchronize_session=False) #sess.flush() transaction.commit() resp = { 'status': True, 'msg': 'Ok' } return resp except (KeyError, StatementError, NoResultFound) as exc: resp = { 'status': False, 'msg': repr(exc), 'errors':{} } return resp -- 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/-/PhUyPP9bBuMJ. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.