Hi there, I'm been puzzling over this and still can't find answer.
I have 2 tables: Nodes: class NodesModel(db.Model): __tablename__ = 'nodes' id = db.Column(db.BigInteger, primary_key=True) project_uuid = db.Column(UUID(as_uuid=True), db.ForeignKey('projects.uuid')) name = db.Column(db.String(50), nullable=False) size = db.Column(db.Integer, nullable=False) posts_nodes = relationship("PostsNodesModel", backref="nodes") relationships = relationship("RelationshipsModel", backref="nodes") Relationships: class RelationshipsModel(db.Model): __tablename__ = 'relationships' source_node_id = db.Column(db.BigInteger, db.ForeignKey('nodes.id'), primary_key=True) target_node_id = db.Column(db.BigInteger, db.ForeignKey('nodes.id'), primary_key=True) strength = db.Column(db.Integer, nullable=False) I'm getting errors on this line: relationships = relationship("RelationshipsModel", backref="nodes") And I know it is because my Relationships table has the Nodes table as a foreign key twice. But I have not idea how do I create 2 relationships to the Relationships table? Thanks for the help. Desmond -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/CAM%2BCzajsO8SALSKG5X5V_sy-08jgy%2B9SPxttj6yPpGvKqEHNPQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.