Building Data-Driven Web Apps with Pyramid and SQLAlchemy Transcripts
Chapter: Using SQLAchemy
Lecture: Concept: Inserting data
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
We started off this chapter by demoing
0:02
how to insert data.
0:03
Let's actually summarize now here at the end.
0:06
So again, we're going to create a session
0:08
which is the corresponding unit of work
0:11
bit of syntax in SQLAlchemy.
0:13
Then we're just going to allocate some objects
0:15
so here we're going to create a package
0:17
and set its ID and its author
0:19
maybe create some releases, set the release
0:23
not package value, other properties similarly
0:26
release two, set its package.
0:28
We're going to add the package, call commit
0:30
whoosh, all three of those things
0:32
because of the relationships get inserted into the database.
0:36
Super easy.