Hello,
This is a very weird problem and I don't which part of the stack is
the culprit (which is really a structural problem in tg by the way -
when something goes wrong, there are so many layers and libraries
intricated that you are lost as to what the explanation is).
I have the following downgrade() method in an sqlalchemy migrate
script:
def downgrade():
# Operations to reverse the above upgrade go here.
migrate_engine.echo = True
init_model(migrate_engine)
db_session.query(User).filter_by(user_name=u'ambassadeur').delete
()
db_session.flush()
transaction.commit()
The problem is that, although I do transaction.commit(), the COMMIT is
not issued and therefore the row is not actually deleted in the DB:
Downgrading...2009-03-18 14:27:08,965 INFO
sqlalchemy.engine.base.Engine.0x...9490 BEGIN
2009-03-18 14:27:08,966 INFO sqlalchemy.engine.base.Engine.0x...9490
SELECT tg_user.user_id AS tg_user_user_id
FROM tg_user
WHERE tg_user.user_name = %s
2009-03-18 14:27:08,966 INFO sqlalchemy.engine.base.Engine.0x...9490
['ambassadeur']
2009-03-18 14:27:08,968 INFO sqlalchemy.engine.base.Engine.0x...9490
DELETE FROM tg_user WHERE tg_user.user_name = %s
2009-03-18 14:27:08,968 INFO sqlalchemy.engine.base.Engine.0x...9490
['ambassadeur']
done
Success
As you see, the DELETE is issued but there is nothing afterwards, so
the transaction is (I assume) silently rollbacked by the DB when the
connection is closed.
Regards
Antoine.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---