[sqlalchemy] Re: Create association of three or more tables

2022-01-10 Thread fco...@gmail.com
created_at = Column(DateTime) usersroles = relationship("UserOrgRole", back_populates="org") class Role(Base): __tablename__ = "role" id = Column(Integer, primary_key=True) name = Column(Text, index=True, nullable=False) usersorgs = relationship("UserOrgRole&quo

[sqlalchemy] Create association of three or more tables

2022-01-07 Thread fco...@gmail.com
Hi all, I would like to create some association of, at least, 3 tables User, Org (organisation) and Role : a User is given a Role on an Organisation. So I began writing the following snippet but I am stucked as I do not know how I should write relationship() for User to be able to refer Orgs