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() # note this line new_b = B() new_b.a_id = new_a.id session.add(new_b) session.commit() This doesn't require changing anything about the structure you already had in place. Lance -- 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.