RESTful and HTTP APIs in Pyramid Transcripts
Chapter: Conclusion
Lecture: Lightning review: SQLAlchemy

Login or purchase this course to watch this video and the rest of the course contents.
0:01 Next thing we did is we brought a real database and a real orm into the picture. We had this little fake repository thing that I created
0:07 and it worked well enough for test data, it was super simple that was helpful but it was just in memory dictionary really,
0:13 so it loaded up a csv and then it just held that result in memory, so we said no, no, no this is not really how it works,
0:19 it really has a database and that database stores its state somewhere else making our service more restful by being stateless.
0:26 So what did we do in sqlalchemy— we created a car object and derived it from our sqlalchemy base class that we created,
0:34 we gave it a database name like table name is car fine if you're doing a lot of relationships that the name of the object, the name of the type
0:42 and the name of the table matching makes life a little easier but it doesn't have to be the way;
0:46 then we created an auto incrementing primary key integer, in this case I believe in our real example we gave it like a uuid4 type of thing.
0:54 We have a name which is a string, a year which is an integer, price which is a float and so on, we even showed you that you could have relationships
1:02 like over to an owner object or something like that, although technically we didn't model that in our api.

Talk Python's Mastodon Michael Kennedy's Mastodon