The "rollback" of attributes is actually an expiration of all mapped 
attributes.    So "used" would need to be a mapped column for its value to be 
"rolled back".   Other than that, "invite_code" would need to be present in 
"elixir.session" for that to work, if something is causing that not to be the 
case, that would also exclude it from the expiry.


On Jan 8, 2011, at 1:23 AM, Romy wrote:

> This may or may not be specific to SQLAlchemy (rather than elixir),
> but I figured I'd ask seeing as how this list is much more active. I'm
> experiencing only a partial rollback in the following code --
> invite_code gets incremented even when the exception is caught and
> session rolled back. When I switch the two lines after begin(), this
> goes away. I'm using autocommit=True, sqlalchemy 0.6.4.
> 
> ---------------------------------------------------
> invite_code =
> InviteCode.query.filter_by(code=code).first()
> 
> elixir.session.begin()
> user = User(...)
> invite_code.used = invite_code.used +
> 1
> 
> try:
> 
> elixir.session.commit()
> except
> IntegrityError:
>  # Thrown on duplicate email
> address
> 
> elixir.session.rollback()
> 
> return
> ---------------------------------------------------
> 
> Cheers!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@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.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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.

Reply via email to