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
{{ message }}
Repository navigation
fix(postgrest): type rpc() with count but no head as the filter builder - #2053
rpc(..., count=...) without head is typed as RPCFilterRequestBuilder, so rpc(..., count=...).csv() type-checks. It also adds the integration and type-check coverage SDK-2975 asked for. #2051 already made rpc().csv() return a TextRequestBuilder.
Changes
The rpc() overloads of PostgrestClient are reduced to the three SupabaseClient uses: head=False (the default) gives RPCFilterRequestBuilder, head=True gives RPCCountRequestBuilder, and a plain bool gives the union. Before, a call with only count= fell through to the catch-all overload and was typed as the union, which has no csv().
New type-check fixture tests/typecheck/rpc.py, checked with mypy, pyright and pyrefly: rpc(...).csv() and its TextAPIResponse for both clients, count= with and without head=True, and the rejected chains after csv() and csv() on the count builder.
Integration tests in tests/_async and tests/_sync that call a function with .csv() against the local stack.
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
New Features
RPC calls can now return CSV as plain text, with selection and query modifiers applied before requesting CSV output.
Bug Fixes
CSV RPC responses are returned directly as text instead of being wrapped in a structured RPC response.
Documentation
Updated guidance to clarify CSV return behavior and that head=True RPC calls do not support CSV output.
RPC CSV requests now use RPCFilterRequestBuilder.csv(), which returns a TextRequestBuilder. Executing that builder returns CSV response text rather than an RPCResponse. The change updates the migration guidance and compliance registry, and adds synchronous, asynchronous, integration, and type-checking coverage.
Sequence Diagram(s)
sequenceDiagram
participant Caller
participant RPCFilterRequestBuilder
participant TextRequestBuilder
participant RPCEndpoint
Caller->>RPCFilterRequestBuilder: Call csv()
RPCFilterRequestBuilder->>TextRequestBuilder: Return builder with executor, URL, and headers
Caller->>TextRequestBuilder: Call execute()
TextRequestBuilder->>RPCEndpoint: Send CSV request
RPCEndpoint-->>TextRequestBuilder: Return CSV response body
TextRequestBuilder-->>Caller: Return response text
Loading
Change: Bug fix
Merge Risk: Minimal · previous review 50f1b
rpc().csv() now returns a text builder whose execute() yields a CSV string, which is a documented breaking change recorded in MIGRATION.md. I found no remaining merge-blocking risk.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 9c609e04-8532-416d-823a-24e6008d9cd3
Commits
Reviewing files that changed from the base of the PR and between ccb6e1a and 50f1b22.
Files selected for processing: 4
MIGRATION.md
src/postgrest/src/postgrest/client.py
src/postgrest/src/postgrest/request_builder.py
src/postgrest/tests/typecheck/rpc.py
Files skipped from review as they are similar to previous changes: 1
src/postgrest/src/postgrest/request_builder.py
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 1 remain after this review.
spydon
changed the title
fix(postgrest)!: return a text builder from rpc().csv()
fix(postgrest): type rpc() with count but no head as the filter builder
Nov 13, 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
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
rpc(..., count=...)withoutheadis typed asRPCFilterRequestBuilder, sorpc(..., count=...).csv()type-checks. It also adds the integration and type-check coverage SDK-2975 asked for. #2051 already maderpc().csv()return aTextRequestBuilder.Changes
rpc()overloads ofPostgrestClientare reduced to the threeSupabaseClientuses:head=False(the default) givesRPCFilterRequestBuilder,head=TruegivesRPCCountRequestBuilder, and a plainboolgives the union. Before, a call with onlycount=fell through to the catch-all overload and was typed as the union, which has nocsv().tests/typecheck/rpc.py, checked with mypy, pyright and pyrefly:rpc(...).csv()and itsTextAPIResponsefor both clients,count=with and withouthead=True, and the rejected chains aftercsv()andcsv()on the count builder.tests/_asyncandtests/_syncthat call a function with.csv()against the local stack.Fixes SDK-2975