Chrome Extension

Delete records query in SQLAlchemy

To delete rows or records from a table using SQLAlchemy you can use the .delete() method of SQLAlchemy.
self.session.query(
    UserModel
).filter(
    UserModel.id == 100
).delete(synchronize_session=False)

self.session.commit()
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool
Output
Delete records from users table where id is 100

The code will delete all the rows in the user table where the value of the id column will be 100.

Was this helpful?
0 Comments