I have a users table in my MySql database. This table has the fields id , name and age .
How can I delete an entry using id ?
Now I use the following code:
user = User.query.get(id) db.session.delete(user) db.session.commit()
But I do not want to make any requests before the delete operation. Is there any way to do this? I know that I can use db.engine.execute("delete from users where id=...") , but I would like to use the delete() method.
python flask flask-sqlalchemy sqlalchemy
Sergey Nov 26 '14 at 8:45 2014-11-26 20:45
source share