by design it intends to INSERT objects into a particular table in the order that they were save()d to the session, yes. an attribute '_sa_insert_order' is added to the instance when it is saved, and the mapper operation sorts instances on this attribute before inserting. after the flush completes, the attribute is removed. this feature also works across inheritance relationships (i.e. instances of type A, B, and C will maintain insert ordering into tables that are commonly inherited).
On Jan 30, 2007, at 2:46 PM, Ian Kelly wrote: > > Hi, > > Does the UnitOfWork make any guarantees about the order in which > insert operations will be performed in a flush? > > Or, to add some context to the question, if I have a relation sorted > by primary key, where the primary key is generated serially, and I > save the new objects in the same order that I append them to the > collection, then can I get away with not resorting the collection > after a flush? > > Thanks, > Ian Kelly > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---