0Pricing
Flask Academy · Lesson

Create Records and Commit Sessions

Add objects and persist with the session.

The C in CRUD

Creating a record means turning incoming data into a new row in your table. In Flask-SQLAlchemy that flow runs through the session. ✨

Build the Object First

Start by making a fresh model instance with the values you want. Nothing has touched the database yet, it is just a Python object.

user = User(name="Ada", email="ada@mail.com")

All lessons in this course

  1. Create Records and Commit Sessions
  2. Read One and Read Many Endpoints
  3. Update Existing Records Safely
  4. Delete and Handle Missing Rows
← Back to Flask Academy