supabase-py icon indicating copy to clipboard operation
supabase-py copied to clipboard

How do i insert multiple rows with only one write?

Open dj-fiorex opened this issue 3 years ago • 3 comments

Describe the bug Hello, i need to know if there is a way to insert multiple rows with a single write. It'ss a feature that i think is a must to work with an hosted version of supabase and to lower costs of writing to db.

Right now supabase client insert supabase.table("table_name").insert(data).execute() support only a dict and not a list[dict]

I'm a developer so i could do something if someone point me to the right direction.

Thanks

dj-fiorex avatar Mar 17 '22 20:03 dj-fiorex

I believe insert_many has not yet been implemented on postgrest_py ; I think we can get that in the next release 😄

anand2312 avatar Mar 31 '22 03:03 anand2312

Insert appears to work with list[dict] now, so this issue can probably be closed.

bgould132 avatar May 07 '22 06:05 bgould132

Hah thanks for testing that out @bgould132 . Didn't know it worked as such 😄 there should probably still be a separate insert_many method though, as PostgREST has some separate handling for it, so we'll keep this open till we implement that.

anand2312 avatar May 07 '22 07:05 anand2312