Dedicated endpoint for filtering options #851
Replies: 2 comments 1 reply
-
@dmos62 It's hard for me to evaluate this without more details about what it will look like. What URL would you use, and what would an example response look like? |
Beta Was this translation helpful? Give feedback.
-
Warning: I've been thinking too much about this question on my morning walks. Overall, I heartily support this. In fact, I came to the conclusion independently that attaching filtering options to types is too constraining in the long run. So I guess we're synced up there :) Problem with filter options per-type: We need to be able to filter on functions of columns (e.g., filtering on the domain of an email). This is a bit tricky with the current format. In order to make it general, we need to be able to filter on functions that don't return the same output type as their input, and in fact on functions that take arbitrary input (probably requiring the row in question as input, though) and return arbitrary output. Another concern with the current paradigm: We're arbitrarily deciding that the only valid comparisons (e.g., I think a Another benefit is that function overloading would let us avoid some repetition in describing the filters. Final example of something we'd eventually want to support: "return only rows where the sum of columns A and B is greater than the sum of A and B for any of the previous three rows". This is not a very complicated query, and requires a pretty general view of filters (and these sort of local max queries are not uncommon in my experience). |
Beta Was this translation helpful? Give feedback.
-
At the moment we're introducing filtering options to the API, so that frontends can check what filtering options are available for a specific type. Currently, it's being introduced to the types endpoint (
/databases/1/types/
). But, that seems to not be a great idea. See the top-post in this discussion for an example of what this looks like. I don't want to post an example JSON here, since the format is still being discussed and I want to avoid putting WIP code on multiple discussions.When using the types endpoint, we're exposing filtering options per Mathesar type. It's awkward, because some predicates (like
and
,or
,not
), are type-agnostic, but the only sensible way to put them on that endpoint is to repeatedly include them under every Mathesar type.Alone, this seems like a small inconvenience, and it is, but this setup might become more burdensome in the future and I want to put it out there that there's the option to switch to a dedicated endpoint.
Beta Was this translation helpful? Give feedback.
All reactions