Adding a CMS to Your Flask Web App Transcripts
Chapter: Course conclusion
Lecture: Review: Inserting with SQLAlchemy

Login or purchase this course to watch this video and the rest of the course contents.
0:00 we decided to use sequel alchemy to store our data in the database. And I definitely love sequel alchemy. If I'm working with relational databases,
0:09 that's what I would use. The way seek welcoming works is it has this unit
0:14 of work create the thing you make a bunch of database changes and then you all at once in a transaction, save those changes back.
0:21 So that looks like this in code. We create this session saying, db session not create.
0:25 We create a page object set values like the title bureau on the contents and here were normalizing or economical izing them like,
0:33 for example, Ural, that stripped out lower. So just in case somebody has a little space on the end,
0:39 it won't be some weird thing that looks like it should match in the database, but doesn't. Do you want to set this all up?
0:44 Then go the session. I want to add the object that we created. Then we just say session not commit boom,


Talk Python's Mastodon Michael Kennedy's Mastodon