Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. class Patient(Base):
  2. __tablename__ = 'patients'
  3. id = Column(Integer, primary_key=True, nullable=False)
  4. mother_id = Column(Integer, ForeignKey('patients.id'), index=True)
  5. mother = relationship('Patient', primaryjoin='Patient.id==Patient.mother_id', remote_side='Patient.id', uselist=False)
  6. phenoscore = Column(Float)
  7.  
  8. patients = Patient.query.filter(Patient.mother.phenoscore == 10)
  9.  
  10. patients = Patient.query.filter(Patient.mother.has(phenoscore=10))
  11.  
  12. patients = Patient.query.join(Patient.mother, aliased=True)
  13. .filter_by(phenoscore=10)
  14.  
  15. Patient.where(mother___phenoscore=10)
  16.  
  17. Comment.where(post___public=True, post___user___name__like='Bi%')
  18.  
  19. db_session.query(Patient).join(Patient.mother)
  20. .filter(Patient.mother.property.mapper.class_.phenoscore==10)
  21.  
  22. Patient.query.join(Patient.mother)
  23. .filter(Patient.mother.property.mapper.class_.phenoscore==10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement