Description
What problem does this solve or what need does it fill?
As users attempt to filter their data more finely in more complex applications, they may need to combine data from multiple queries in order to get precisely the data they need.
In the simple cases, adding more parameters and types to your query is the correct choice. But this fails when:
- You need the data from the queries separately as well.
- You want to express more complex compound queries, like "has component A or component B in this particular slot"
What solution would you like?
The standard relational database tools and/or set operations should be added, providing a set of (Query, Query) -> Query
functions or methods.
The tools provided by Option<C>
components already should be a heavy inspiration for the implementation and handling of the possibly ragged tables produced.
What alternative(s) have you considered?
We could provide for this behavior at the type level (see Or
and the proposed Not
query filters from #1471), allowing you to merge queries in complicated ways using the type system. This is less flexible and results in extremely complicated nested types, but does in theory mean we can restrict the data faster.
As a workaround, you could extract the list of entities in each query, perform the set operations on those entity lists, and then use query.get
to extract the desired entities and data from each query separately.
Additional context
This came up in the context of #1627 with @BoxyUwU, discussing how to search for entities that have two parents. We can't sensibly have two Relation<ChildOf>
types in the type parameter of a single Query
argument without a great deal of API complication, but looking for intersections etc. of the same relation across multiple entities is a sensible and common operation.
Metadata
Assignees
Labels
Type
Projects
Status
Done
Activity