Use method has()
of relationship (more readable):
patients = Patient.query.filter(Patient.mother.has(phenoscore=10))
or join (usually faster):
patients = Patient.query.join(Patient.mother, aliased=True)\
.filter_by(phenoscore=10)
More Related Contents:
- Sqlite / SQLAlchemy: how to enforce Foreign Keys?
- sqlalchemy: create relations but without foreign key constraint in db?
- SQLAlchemy: get Model from table name. This may imply appending some function to a metaclass constructor as far as I can see
- SQLAlchemy create_all() does not create tables
- How do I get a raw, compiled SQL query from a SQLAlchemy expression?
- How to check if one dictionary is a subset of another larger dictionary?
- SQL Alchemy ORM returning a single column, how to avoid common post processing
- How do I execute inserts and updates in an Alembic upgrade script?
- SQLAlchemy, get object not bound to a Session
- Python: filter list of list with another list
- Python call sql-server stored procedure with table valued parameter
- Generate sql with subquery as a column in select statement using SQLAlchemy
- Complex foreign key constraint in SQLAlchemy
- Flask sqlalchemy many-to-many insert data
- Connection problems with SQLAlchemy and multiple processes
- How to upsert pandas DataFrame to Microsoft SQL Server table?
- remove None value from a list without removing the 0 value
- How do I select literal values in an sqlalchemy query?
- Get inserted key before commit session
- SQLAlchemy multiple foreign keys in one mapped class to the same primary key
- How to change ForeignKey display text in the Django Admin?
- SQLAlchemy: engine, connection and session difference
- Relations on composite keys using sqlalchemy
- Dynamically filtering a pandas dataframe
- flake8 complains on boolean comparison “==” in filter clause
- SQLAlchemy – Mapping self-referential relationship as one to many (declarative form)
- pandas to_sql all columns as nvarchar
- How to make mysql connection that requires CA-CERT with sqlalchemy or SQLObject
- Can’t change system default SQLite binary
- add column to SQLAlchemy Table