How do I create a relation that filters the list property when accessing the
data?

class Parent(Base):
    __tablename__ = 'parent'
    id = Column(Integer, primary_key=True)
    name = Column(String)

class Child(Base):
    __tablename__ = 'child'
    id = Column(Integer, primary_key=True)
    pid = Column(Integer, ForeignKey('parent.id'))
    name = Column(String)
    bg = Column(String)  # b=boy, g=girl

Parent.children = relation(Child, backref='parent')

Gives me a relation that can be used to get a list of all children




Question is how to specify a relation that gives a list of the boys

Parent.boys = relation(Child, ??????????????????)

I suspect it is something pretty straight forward, but can't figure it out

-- 
Mike Conley

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to