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
Dave Lawrence edited this page Feb 24, 2022
·
4 revisions
For a quick overview of how the node filters work, see ASMR Poster
node annotation kwargs
Nodes can return a dict of kwargs that are passed to Django queryset.annotate() - this is so you can setup FilteredRelations etc, controlling how you join to another table (eg to restrict it to just 1 PostGres partition)
node Q objects
Nodes perform filtering by returning a Django Q object - these represent SQL operations, and can be combined easily via AND and OR operations.
Applying annotation/filters in different orders can cause multiple joins to the same table (even when using FilteredRelation) - so the node Qs are stored in a dictionary, with keys being the node annotation kwargs. There are applied in the order of annotation kwargs.
Chains of filters to a reverse foreign key relationship causes multiple joins, so use Q objects which are combined at the end