I cannot read the column of another table that is joined. It throws an AttributeError
class Component(Model): id = IntegerField(primary_key=True) title = CharField() class GroupComponentMap(Model): group = ForeignKeyField(Component, related_name='group_fk') service = ForeignKeyField(Component, related_name='service_fk')
Now request
comp = (Component .select(Component, GroupComponent.group.alias('group_id')) .join(GroupComponent, on=(Component.id == GroupComponent.group)) ) for row in comp: print row.group_id
Now I get the AttributeError: 'Component' object has no attribute 'group_id' error message AttributeError: 'Component' object has no attribute 'group_id'
source share