mapper(Item, items_table, properties={
# key by column
- notes = relation(Note, collection_class=column_mapped_collection(notes_table.c.keyword))
+ 'notes': relation(Note, collection_class=column_mapped_collection(notes_table.c.keyword)),
# or named attribute
- notes2 = relation(Note, collection_class=attribute_mapped_collection('keyword'))
+ 'notes2': relation(Note, collection_class=attribute_mapped_collection('keyword')),
# or any callable
- notes3 = relation(Note, collection_class=mapped_collection(lambda entity: entity.a + entity.b))
+ 'notes3': relation(Note, collection_class=mapped_collection(lambda entity: entity.a + entity.b))
})
# ...