Skip to main content

Delete rows

delete

You can delete rows by calling the delete function like this:

from abstra.tables import delete

deleted = delete("users", {"id": 123})
deleted # [{"name": "foo", "email": "bar"}]

Which is equivalent to

DELETE FROM users
WHERE id = 123
RETURNING *

delete_by_id

If you only need to set the id in the where filter, you can use delete_by_id instead:

from abstra.tables import delete_by_id

deleted = delete_by_id(
"users",
id=123
)
deleted # [{"name": "foo", "email": "bar"}]

Which is equivalent to

DELETE FROM users
WHERE id = 123
RETURNING *