Typing on .upsert() does not expect arrays for bulk inserts
AdamGEmerson opened this issue · comments
Bug report
Describe the bug
I noticed that the json
parameter in the upsert()
method is typed as dict
, which throws a warning in my IDE on bulk inserts.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
payloads = []
for i in range(0, 5):
payloads.append({'id': i, 'text': 'hello'})
# Warning appears here
supabase.table('test').upsert(payloads).execute()
Expected behavior
As arrays of data are supported by the library, we should correct the typing on the upsert()
definition to be a Union[dict, list]
, like how the insert()
function is defined. In my testing this seems to resolve the issue.
Screenshots
System information
- OS: [macOS]
- Version of supabase-py: 0.10.6
- Version of Python: 3.9
Additional context
I would like to generate a PR for this as it seems like a good first issue if the community here agrees it should be resolved.
Thanks!