I believe it's both mapped and present in the session -- the log
output seems to confirm it:

[I 110108 22:40:30 base:1075] BEGIN
[I 110108 22:40:30 base:1390] UPDATE invite_codes SET used=%s WHERE
invite_codes.id = %s
[I 110108 22:40:30 base:1391] (1L, 100L)
[I 110108 22:40:30 base:1390] INSERT INTO users (username, email,
password, verified, usertype_id, invite_code_id, created,
invites_left) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)
[I 110108 22:40:30 base:1391] (u'blah', u'a...@b.com', '<snip>', False,
1L, 100L, datetime.datetime(2011, 1, 9, 6, 40, 30, 808683), 5)
[I 110108 22:40:30 base:1086] ROLLBACK

The update's part of the transaction above, but it doesn't get rolled
back.. scratching my head here.

On Jan 8, 8:20 am, Michael Bayer <mike...@zzzcomputing.com> wrote:
> 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 
> > athttp://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