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
- Create Records and Commit Sessions
- Read One and Read Many Endpoints
- Update Existing Records Safely
- Delete and Handle Missing Rows