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
Update client methods to mirror postgrest return type hints
Describe the chore
Methods in both sync & async clients specify generic return types without type arguments, resulting in linter warnings.
deffrom_(self, table_name: str) ->SyncRequestBuilder:
"""Perform a table operation. See the `table` method. """returnself.postgrest.from_(table_name)
query=supabase.from_("foo") # Type of "from_" is "(table_name: str) -> SyncRequestBuilder[Unknown]" [reportUnknownMemberType]
Even with type hinting on the variable, we get a similar error
classFoo(BaseModel):
...
foos: list[Foo] =supabase.from_("foo").select("*").execute().data# Type of "data" is "List[Unknown]" [reportUnknownMemberType]
The underlying postgrest methods do specify type arguments, but this is hidden behind the type hints in the supabase client. There seem to be two possible resolutions here:
Remove type hints from methods in the supabase clients and allow underlying postgrest type hints to propagate
deffrom_(self, table_name: str):
...
Add type arguments to existing generic return types in the supabase clients
I tend to prefer option 1 since these methods are simple wrappers - if postgrest-py updates their return types in the future, why have the burden of updating those here as well?
Chore
Update client methods to mirror postgrest return type hints
Describe the chore
Methods in both sync & async clients specify generic return types without type arguments, resulting in linter warnings.
Even with type hinting on the variable, we get a similar error
The underlying postgrest methods do specify type arguments, but this is hidden behind the type hints in the supabase client. There seem to be two possible resolutions here:
I tend to prefer option 1 since these methods are simple wrappers - if postgrest-py updates their return types in the future, why have the burden of updating those here as well?
Additional context
postgrest-py from_ method
The text was updated successfully, but these errors were encountered: