Whoops, forgot to get to this email. These pickle problems are very tough since the pickle module gives you no indication of how it gets to what can't be serialized.
I see you're using pickle format "2" to try to get around the issue but that's not really a solution here. A callable that's serializable would need to be used, this can be fixed in SQLAlchemy (added http://www.sqlalchemy.org/trac/ticket/2409) but here's a workaround: class SerializableGetter(object): def __init__(self, name): self.name = name def __call__(self, target): return getattr(target, self.name) class Parent(Base): # ... children = relationship('Child', collection_class=lambda: MappedCollection(SerializableGetter('key'))) On Feb 16, 2012, at 10:54 AM, Alex Grönholm wrote: > So basically this comes down the operator.attrgetter not being serializable. > I'm wondering why something like this would be serialized at all -- aren't > collections part of the class definition? > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/sqlalchemy/-/sgLu0zjWla0J. > To post to this group, send email to [email protected]. > 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. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. 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.
