You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It asks for instances of Profile, ProposalSpace and TicketType to be loaded in sequence, raising a 404 if one is not found. This requires three database roundtrips, which is inefficient. This can be done in one query if we work up from the bottom:
To support this syntax, load_models could change the tuple format it accepts slightly. The second item in the tuple is a mapping of a model attribute to a view parameter, for use with the filter_by filter. This could instead be a column (a SQLAlchemy Instrumented Attribute) that is applied with a filter filter. Since the column-containing models are also required to perform a join, the wrapping tuple could accept a fourth item, a model or a tuple of models that must be joined (L-to-R) (or this could be guessed by looking up the models to which the given filter columns are attached).
The text was updated successfully, but these errors were encountered:
Joined loads are supported via InstanceLoader introduced in #167. This ticket is now irrelevant. The redirect handler issue can be solved by writing a custom loader wherever it is needed.
A typical
load_models
decoration looks like this:It asks for instances of Profile, ProposalSpace and TicketType to be loaded in sequence, raising a 404 if one is not found. This requires three database roundtrips, which is inefficient. This can be done in one query if we work up from the bottom:
TicketType.query.join(ProposalSpace).join(Profile).filter(TicketType.name == name, ProposalSpace.name == space, Profile.name == g.profile).first_or_404()
To support this syntax, load_models could change the tuple format it accepts slightly. The second item in the tuple is a mapping of a model attribute to a view parameter, for use with the
filter_by
filter. This could instead be a column (a SQLAlchemy Instrumented Attribute) that is applied with afilter
filter. Since the column-containing models are also required to perform a join, the wrapping tuple could accept a fourth item, a model or a tuple of models that must be joined (L-to-R) (or this could be guessed by looking up the models to which the given filter columns are attached).The text was updated successfully, but these errors were encountered: