Query then Delete using Flask-SQLAlchemy

14 Views Asked by At

I wanted to know if there was a better way to query a table for a single row and then delete the row? Right now I'm doing two separate calls. Is there way to just call .delete() on a query result?

Example:

_qry = MyPath.query.find(MyPath.id == id).first()
# Do something with the data ...
# Now delete the row
_qry.delete()
0

There are 0 best solutions below