[sqlalchemy] Re: session get last row id?

2010-07-24 Thread manman
thanks. if not use relation then how to do? i hate use ForeignKey or ManyToMany. -- 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

Re: [sqlalchemy] Re: session get last row id?

2010-07-24 Thread Lance Edgar
On Sat, 2010-07-24 at 07:06 -0700, manman wrote: thanks. if not use relation then how to do? i hate use ForeignKey or ManyToMany. So did the explicit call to session.flush() not work? Here it is again for reference: new_a = A() session.begin() session.add(new_a) session.flush()

[sqlalchemy] Re: session get last row id?

2010-07-24 Thread manman
if use flush() then how to 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

Re: [sqlalchemy] Re: session get last row id?

2010-07-24 Thread Alexandre Conrad
flush is not commit. After a flush, you can still rollback. 2010/7/24 manman ne.man...@gmail.com if use flush() then how to rollback ? -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] Re: session get last row id?

2010-07-24 Thread manman
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

Re: [sqlalchemy] Re: session get last row id?

2010-07-24 Thread Lance Edgar
On Sat, 2010-07-24 at 08:06 -0700, manman wrote: 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? Should