Hi everyone, in my script I'm using column_mapped_collection to create a collection indexed by a column of a certain table. This is an example scenario (pseudo code):
class Parent(object): def __init__(self): # define some fileds def AddChild(self, new_child): self.children[new_child.name] = new_child class Child(object): def __init__(self, name): self.name = name rel = relationship(Child, collection_class=column_mapped_collection(child_tab.c.name)) mapper(Parent, parent_tab, properties={"children":rel}) mapper(Child, child_tab) p = Parent() p.AddChild(Child("child1")) p.AddChild(Child("child2")) session.add(p) session.commit() Everything works fine except for the fact that after the commit it generally happens that the insertion order is not respected, that is the child2 record is stored before child1. Is there a way to modify the code so that the insertion order is preserved? I think this is somehow linked to the use of Ordereddict but I have no idea about how to achieve it! Any help is appreciated, thanks in advance! -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.