Skip to content

Commit e9c219e

Browse files
authored
fix(postgrest): add missing count, head, and get params (#1098)
1 parent d5aa9ce commit e9c219e

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

supabase/_async/client.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
AsyncRPCFilterRequestBuilder,
1212
)
1313
from postgrest.constants import DEFAULT_POSTGREST_CLIENT_TIMEOUT
14+
from postgrest.types import CountMethod
1415
from realtime import AsyncRealtimeChannel, AsyncRealtimeClient, RealtimeChannelOptions
1516
from storage3 import AsyncStorageClient
1617
from storage3.constants import DEFAULT_TIMEOUT as DEFAULT_STORAGE_CLIENT_TIMEOUT
@@ -139,7 +140,12 @@ def from_(self, table_name: str) -> AsyncRequestBuilder:
139140
return self.postgrest.from_(table_name)
140141

141142
def rpc(
142-
self, fn: str, params: Optional[Dict[Any, Any]] = None
143+
self,
144+
fn: str,
145+
params: Optional[Dict[Any, Any]] = None,
146+
count: Optional[CountMethod] = None,
147+
head: bool = False,
148+
get: bool = False,
143149
) -> AsyncRPCFilterRequestBuilder:
144150
"""Performs a stored procedure call.
145151
@@ -149,6 +155,9 @@ def rpc(
149155
The stored procedure call to be executed.
150156
params : dict of any
151157
Parameters passed into the stored procedure call.
158+
count: The method to use to get the count of rows returned.
159+
head: When set to `true`, `data` will not be returned. Useful if you only need the count.
160+
get: When set to `true`, the function will be called with read-only access mode.
152161
153162
Returns
154163
-------
@@ -158,7 +167,7 @@ def rpc(
158167
"""
159168
if params is None:
160169
params = {}
161-
return self.postgrest.rpc(fn, params)
170+
return self.postgrest.rpc(fn, params, count, head, get)
162171

163172
@property
164173
def postgrest(self):

supabase/_sync/client.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
SyncRPCFilterRequestBuilder,
1111
)
1212
from postgrest.constants import DEFAULT_POSTGREST_CLIENT_TIMEOUT
13+
from postgrest.types import CountMethod
1314
from realtime import RealtimeChannelOptions, SyncRealtimeChannel, SyncRealtimeClient
1415
from storage3 import SyncStorageClient
1516
from storage3.constants import DEFAULT_TIMEOUT as DEFAULT_STORAGE_CLIENT_TIMEOUT
@@ -138,7 +139,12 @@ def from_(self, table_name: str) -> SyncRequestBuilder:
138139
return self.postgrest.from_(table_name)
139140

140141
def rpc(
141-
self, fn: str, params: Optional[Dict[Any, Any]] = None
142+
self,
143+
fn: str,
144+
params: Optional[Dict[Any, Any]] = None,
145+
count: Optional[CountMethod] = None,
146+
head: bool = False,
147+
get: bool = False,
142148
) -> SyncRPCFilterRequestBuilder:
143149
"""Performs a stored procedure call.
144150
@@ -148,6 +154,9 @@ def rpc(
148154
The stored procedure call to be executed.
149155
params : dict of any
150156
Parameters passed into the stored procedure call.
157+
count: The method to use to get the count of rows returned.
158+
head: When set to `true`, `data` will not be returned. Useful if you only need the count.
159+
get: When set to `true`, the function will be called with read-only access mode.
151160
152161
Returns
153162
-------
@@ -157,7 +166,7 @@ def rpc(
157166
"""
158167
if params is None:
159168
params = {}
160-
return self.postgrest.rpc(fn, params)
169+
return self.postgrest.rpc(fn, params, count, head, get)
161170

162171
@property
163172
def postgrest(self):

0 commit comments

Comments
 (0)