Using Query Method in the Session Object

Learn how to use query methods like create, read, update and delete in the session object.

Database theorists refer to the four fundamental data manipulation operations with the acronym CRUD: Create, Read, Update, and Delete. We’ve seen Create, so let’s move on to the others. These are related to the HTTP methods POST, GET, PUT, and DELETE, respectively.

Reading records using session

The session object includes a query method that creates an iterable to iterate over each record in the table. Here, we print out the book’s ID and title. Since we didn’t assign ID’s, the database chose them.

Get hands-on with 1200+ tech skills courses.