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
Using supabase python API client, if you want to perform a count on a query without querying for result (i.e head=True), you'll get an empty array and a count equals to 0.
Try it out:
select("*", head=True, count="exact")
This is because when Head=True, you use HEAD as http request method. Consequently, the result won't have a json, so this method will throw a JSONDecodeError:
@classmethoddeffrom_http_request_response(
cls: Type[Self], request_response: RequestResponse
) ->Self:
try:
data=request_response.json()
exceptJSONDecodeError:
returncls(data=[], count=0)
count=cls._get_count_from_http_request_response(request_response)
# the type-ignore here is as pydantic needs us to pass the type parameter# here explicitly, but pylance already knows that cls is correctly parametrizedreturncls[_ReturnT](data=data, count=count) # type: ignore
In think we should just assign data to an empty array if an error occurs:
@classmethoddeffrom_http_request_response(
cls: Type[Self], request_response: RequestResponse
) ->Self:
try:
data=request_response.json()
exceptJSONDecodeError:
data= []
count=cls._get_count_from_http_request_response(request_response)
# the type-ignore here is as pydantic needs us to pass the type parameter# here explicitly, but pylance already knows that cls is correctly parametrizedreturncls[_ReturnT](data=data, count=count) # type: ignore
The text was updated successfully, but these errors were encountered:
Using supabase python API client, if you want to perform a count on a query without querying for result (i.e head=True), you'll get an empty array and a count equals to 0.
Try it out:
select("*", head=True, count="exact")
This is because when Head=True, you use HEAD as http request method. Consequently, the result won't have a json, so this method will throw a JSONDecodeError:
In think we should just assign data to an empty array if an error occurs:
The text was updated successfully, but these errors were encountered: