rollback is not reverting your own changes to the objects. u have to 
do fix it youself.
can that be?

On Saturday 20 September 2008 20:53:33 Mariano Cortesi wrote:
> Hi,
>
> I'm having a problem with session rollback.
>
> I have a block something like:
>
> def f():
>   try:
>      #do some queries with session
>      self.session.commit()
>   except Exception, e:
>      self.session.rollback()
>      raise
>
> the function that calls f() catchs de exception a do another
> transactional block...
> that is:
> try:
>    # use the session
>    self.session.commit()
> except Exception, e:
>    self.session.rollback()
>
> The problem I have is that both block fail with the same error; as
> if the first rollback didn't work...
> My patch was to add a self.session.remove() aftter the first
> rollback, and now the problem is gone.
> But it seems it's a hack and not the best solution.
>
> Note about the self.session:
> self.session was created by:
>
> from sqlalchemy import orm
>
> session = orm.scoped_session(
>                 orm.sessionmaker(transactional=True,
> autoflush=False))
>
>
> Any ideas of what I'm missing?
> Is my explantion clear enough??
>
> Thanks in advance,
> Mariano Cortesi
> Zauber - Popego
>
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to