Adding a CMS to Your Pyramid Web App Transcripts
Chapter: Course conclusion
Lecture: Review: Inserting with SQLAlchemy
0:00 we decided to use sequel alchemy to store our data in the database. And I definitely love sequel alchemy.
0:07 If I'm working with relational databases, that's what I would use.
0:11 The way seek welcoming works is it has this unit 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, for example, Ural, that stripped out lower.
0:36 So just in case somebody has a little space on the end, it won't be some weird thing that looks like it should match in the database, but doesn't.
0:43 Do you want to set this all up? Then go the session. I want to add the object that we created.
0:48 Then we just say session not commit boom, because sequel alchemy is awesome. This is now saved and inserted into the