Search⌘ K

Update & Delete

Understand how to perform update and delete operations on database records within Flask using SQLAlchemy. Learn to retrieve objects by primary key, modify their attributes, delete objects, and commit these changes to persist them. This lesson helps you effectively manage database records as part of web application development.

Update and delete are also basic operations that are performed on a database. So, let’s find out how we perform these operations using the SQLAlchemy ORM.

Update #

The method for updating a record is very straightforward, and you do not have to remember any new commands. It can be achieved in three easy steps.

1. Retrieve the object to update #

First, to update any record that is already ...