-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
For simple fields, we can use Column.info for attaching FA-related metdata to columns. For ManyToOne fields, we can change info for related ForeignKey column. But for ManyToMany fields, there is not a simple way.
Suppose this schema: (simple ManyToMany relation)
class Item(Base):
__tablename__ = 'items'
id = Column(Integer, primary_key=True)
name = Column(Unicode(255))
model_items_table = Table('model_items', Base.metadata,
Column('item_id', Integer, ForeignKey(Item.id), primary_key=True),
Column('model_id', Integer, ForeignKey('models.id'), primary_key=True))
class MyModel(Base):
__tablename__ = 'models'
id = Column(Integer, primary_key=True)
name = Column(Unicode(255))
many_to_many = relationship(Item, secondary=model_items_table)We want to change ManyToMany renderer by adding info={'renderer: ...} keyword argument for a Column, but which Column?
The right Column should be one of columns in intermediate table(model_items), but adding this doesn't work for either of those two columns.
Default implementation of AttributeField.info() only checks info attribute of Item.id which is not sufficient.
Metadata
Metadata
Assignees
Labels
No labels