Repository navigation
Conversation
cs, cd, contains, contained_by and ov (and overlaps, which delegates to
ov) passed values straight to ",".join(...), raising TypeError on
non-string iterables such as integer arrays — despite their signatures
accepting Iterable[Any]. in_ already handles this via sanitize_param.
Coerce each element with str() so e.g. .contains("ids", [1, 2, 3])
produces {1,2,3}. Existing string behaviour is unchanged.
Fixes supabase#1529
Contributor
|
I'll accept this as a patch up but I think the proper solution would be to remove the |
o-santi
approved these changes
Jul 9, 2026
gottostartsomewhere
added a commit
to gottostartsomewhere/supabase-py
that referenced
this pull request
Jul 9, 2026
Address review on supabase#1530: instead of only coercing values at runtime, remove Any from the filter argument annotations. Add a FilterValue alias (str | int | float | bool) and type the array/collection filters (in_, cs, cd, contains, contained_by, ov, overlaps) with it, and type the JSON-object branch as Dict[str, JSON]. Runtime str-coercion is kept so integer arrays still work. mypy clean; existing tests pass.
This was referenced Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes #1529.
The array/range filter methods
cs,cd,contains,contained_by, andov(andoverlaps, which delegates toov) passed values directly to",".join(...), which raisesTypeErroron non-string iterables like integer arrays — even though the signatures acceptIterable[Any].in_already avoids this by mapping throughsanitize_param.Integer array columns (
int[]) are common in Postgres, so this is easy to hit.Change
Coerce each element with
str()before joining in the five affected methods, so.contains("ids", [1, 2, 3])builds{1,2,3}. This mirrors whatin_already does and leaves existing string behaviour unchanged (verified against the existing tests, including ones with reserved characters likeoverlaps("x", ["is:closed", "severity:high"])).The change is in the shared
base_request_builder.py, so it fixes both sync and async builders.Tests
Added
test_{contains,cs,cd,contained_by,overlaps}_non_string_itemsto both the async and sync filter-builder test suites. They fail onmain(TypeError) and pass with the fix. Full filter test suite: 84 passed.