Skip to content

Instantly share code, notes, and snippets.

@Andygmb
Created November 27, 2014 05:08
Show Gist options
  • Save Andygmb/32e2380212fe6af9672e to your computer and use it in GitHub Desktop.
Save Andygmb/32e2380212fe6af9672e to your computer and use it in GitHub Desktop.
class Parent(Base):
__tablename__ = 'parent'
id = Column(Integer, primary_key=True)
children = relationship("Child0"), relationship("Child1"), relationship("Child2")
class Child0(Base):
__tablename__ = 'child'
id = Column(Integer, primary_key=True)
parent_id = Column(Integer, ForeignKey('parent.id'))
class Child1(Base):
__tablename__ = 'child'
id = Column(Integer, primary_key=True)
parent_id = Column(Integer, ForeignKey('parent.id'))
class Child2(Base):
__tablename__ = 'child'
id = Column(Integer, primary_key=True)
parent_id = Column(Integer, ForeignKey('parent.id'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment