Python: Delete data | Supabase Docs (original) (raw)
delete()
should always be combined with filters to target the item(s) you wish to delete.If you use
delete()
with filters and you have RLS enabled, only rows visible throughSELECT
policies are deleted. Note that by default no rows are visible, so you need at least oneSELECT
/ALL
policy that makes the rows visible.When using
delete().in_()
, specify an array of values to target multiple rows with a single query. This is particularly useful for batch deleting entries that share common criteria, such as deleting users by their IDs. Ensure that the array you provide accurately represents all records you intend to delete to avoid unintended data removal.
Parameters
count
(Optional)
The property to use to get the count of rows returned.
returning
(Optional)
Either 'minimal' or 'representation'. Defaults to 'representation'.
Examples
Delete records
response = (
supabase.table("countries")
.delete()
.eq("id", 1)
.execute()
)
Delete multiple records
response = (
supabase.table("countries")
.delete()
.in_("id", [1, 2, 3])
.execute()
)