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()
Code faster with devsheet chrome extension and increase productivity as a programmer
search code from your favorite search engine instantly.
Install Now
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
Open Code Manager We are hiring