How can I do a multiple-level eager load in SQLAlchemy?

orm, python, sql, sqlalchemy

Solution

Straight from the documentation of `subqueryload`:

qry = query(A).options(subqueryload(A.b).subqueryload(B.c))

Problem

I have many `C`s in a `B` and many `B`s in an `A`, and I have backref relationships defined. What I want to do is something like: ``` a = A.query().options(subqueryload(A.b).subsubqueryload(B.c) ``` How should this be done?

Original source