new_a=A()
session.begin()
session.add(new_a)
session.flush()
new_b=B()
new_b.a_id=new_a.id
session.add(new_b)

try:
  session.commit()
except:
  session.rollback()
  raise

this code is right? when error all be rollback?

-- 
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