diff --git a/supabase/_async/client.py b/supabase/_async/client.py index 7fc722f6..10ba437e 100644 --- a/supabase/_async/client.py +++ b/supabase/_async/client.py @@ -11,6 +11,7 @@ AsyncRPCFilterRequestBuilder, ) from postgrest.constants import DEFAULT_POSTGREST_CLIENT_TIMEOUT +from postgrest.types import CountMethod from realtime import AsyncRealtimeChannel, AsyncRealtimeClient, RealtimeChannelOptions from storage3 import AsyncStorageClient from storage3.constants import DEFAULT_TIMEOUT as DEFAULT_STORAGE_CLIENT_TIMEOUT @@ -139,7 +140,12 @@ def from_(self, table_name: str) -> AsyncRequestBuilder: return self.postgrest.from_(table_name) def rpc( - self, fn: str, params: Optional[Dict[Any, Any]] = None + self, + fn: str, + params: Optional[Dict[Any, Any]] = None, + count: Optional[CountMethod] = None, + head: bool = False, + get: bool = False, ) -> AsyncRPCFilterRequestBuilder: """Performs a stored procedure call. @@ -149,6 +155,9 @@ def rpc( The stored procedure call to be executed. params : dict of any Parameters passed into the stored procedure call. + count: The method to use to get the count of rows returned. + head: When set to `true`, `data` will not be returned. Useful if you only need the count. + get: When set to `true`, the function will be called with read-only access mode. Returns ------- @@ -158,7 +167,7 @@ def rpc( """ if params is None: params = {} - return self.postgrest.rpc(fn, params) + return self.postgrest.rpc(fn, params, count, head, get) @property def postgrest(self): diff --git a/supabase/_sync/client.py b/supabase/_sync/client.py index d8da3a09..45d2de72 100644 --- a/supabase/_sync/client.py +++ b/supabase/_sync/client.py @@ -10,6 +10,7 @@ SyncRPCFilterRequestBuilder, ) from postgrest.constants import DEFAULT_POSTGREST_CLIENT_TIMEOUT +from postgrest.types import CountMethod from realtime import RealtimeChannelOptions, SyncRealtimeChannel, SyncRealtimeClient from storage3 import SyncStorageClient from storage3.constants import DEFAULT_TIMEOUT as DEFAULT_STORAGE_CLIENT_TIMEOUT @@ -138,7 +139,12 @@ def from_(self, table_name: str) -> SyncRequestBuilder: return self.postgrest.from_(table_name) def rpc( - self, fn: str, params: Optional[Dict[Any, Any]] = None + self, + fn: str, + params: Optional[Dict[Any, Any]] = None, + count: Optional[CountMethod] = None, + head: bool = False, + get: bool = False, ) -> SyncRPCFilterRequestBuilder: """Performs a stored procedure call. @@ -148,6 +154,9 @@ def rpc( The stored procedure call to be executed. params : dict of any Parameters passed into the stored procedure call. + count: The method to use to get the count of rows returned. + head: When set to `true`, `data` will not be returned. Useful if you only need the count. + get: When set to `true`, the function will be called with read-only access mode. Returns ------- @@ -157,7 +166,7 @@ def rpc( """ if params is None: params = {} - return self.postgrest.rpc(fn, params) + return self.postgrest.rpc(fn, params, count, head, get) @property def postgrest(self):