Есть исключение:
sqlalchemy.exc.ArgumentError: Relationship User.followings could not determine any unambiguous local/remote column pairs based on join condition and remote_side arguments. Consider using the remote() annotation to accurately mark those elements of the join condition that are on the remote side of the relationship.
Я испробовал все способы обозначения связей в моделях. Я не знаю, что делать(
Моя модель пользователя
class User(SQLAlchemyBaseUserTable[int], Base):
...
followings = relationship(
'User',
secondary=Subscription,
primaryjoin=(id == Subscription.c.follower_id), # local side сторона
secondaryjoin=(id == Subscription.c.author_id), # remote side
back_populates='followers',
remote_side=Subscription.c.author_id,
viewonly=True
)
followers = relationship(
'User',
secondary=Subscription,
primaryjoin=(id == Subscription.c.author_id), # local side
secondaryjoin=(id == Subscription.c.follower_id), # remote side
back_populates='followings',
remote_side=Subscription.c.follower_id,
viewonly = True
)
Моя таблица подписки
Subscription = Table(
'followers',
Base.metadata,
Column('author_id', Integer, ForeignKey('user.id'), primary_key=True),
Column('follower_id', Integer, ForeignKey('user.id'), primary_key=True)
)
Подробнее здесь: https://stackoverflow.com/questions/790 ... ions-model