1. paulgb
  2. sqlalchemy


jason kirtland  committed 8214260

Typo fix (thanks Ben!)

  • Participants
  • Parent commits c43ef51
  • Branches default

Comments (0)

Files changed (1)

File doc/build/content/mappers.txt

View file
 A `dict` can be used as a collection, but a keying strategy is needed to map entities loaded by the ORM to key, value pairs.  The [collections](rel:docstrings_sqlalchemy.orm.collections) package provides several built-in types for dictionary-based collections:
-    from sqlalchemy.orm.collections import column_mapped_collection, attr_mapped_collection, mapped_collection
+    from sqlalchemy.orm.collections import column_mapped_collection, attribute_mapped_collection, mapped_collection
     mapper(Item, items_table, properties={
         # key by column
         notes = relation(Note, collection_class=column_mapped_collection(notes_table.c.keyword))
         # or named attribute 
-        notes2 = relation(Note, collection_class=attr_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))