Adding a CMS to Your Pyramid Web App Transcripts
Chapter: Saving content to a database
Lecture: Concept: Inserting data

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's quickly review how to insert an object into the database with sequel alchemy. It's pretty easy.
0:07 We've moved the ability to create these sessions or in sequel Commies Nomenclature, a unit of work over to this DB session class.
0:14 All we have to do is call, create, and it sets everything up just the way we like. We create one of the objects we want insert.
0:20 So we want to insert a page. We just created a age variable, which is the new page.
0:26 We set the things like title in the Euro and the contents and make sure that you normalize them like that.
0:32 The euro's lower case that makes a lot easier and so on. And then finally, we're going to add that to the session and then commit the session.
0:40 That's it. Now this pages in the database and we can start going quarry to increase for it. Like give me the page by its URL. Or if you knew the i d.
0:48 You got it back right set by the database. When you get it back, you could work with I D. And why not? That's it.
0:55 Secret alchemy is pretty awesome, isn't it?

Talk Python's Mastodon Michael Kennedy's Mastodon