Building Data-Driven Web Apps with Flask and SQLAlchemy Transcripts
Chapter: MongoDB edition
Lecture: The rest of the entities

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Over here in our NoSQL folder we have our setup and we have our users. But there's a bunch of stuff we need like packages and maintainers and licenses.
0:09 You saw how easy it was and how similar this was to SQLAlchemy for users. Let me just drop in the rest. There's no reason to watch me type it all out.
0:16 So we can go through. And here we have the downloads which are straightforward. I guess we don't need table name anymore.
0:23 We've got package_id and release_id and all these things. And of course we're setting up indexes on them.
0:30 Languages, this is again similar to what we had before. Licenses also. You are overwriting the type of key which is certainly possible
0:40 something you can do just like we are in packages. Over here, we're setting the string field to be a primary key. This, let's just store a string
0:47 instead of that object ID type of thing. And everything along here looks pretty much the same as it was in SQLAlchemy
0:53 but here's where we start to leverage the hierarchical aspect of document databases over tabular stuff say, in relational. Here's our maintainers.
1:03 Previously, we had a maintainers table and what it stored was project ID, maintainer ID and it was just the normalization table
1:12 for the many-to-many relationship. We don't have to do that here. We can store, actually a list of all the maintainer IDs
1:19 which then are relationships navigating back keys back to the user table. So we don't need that normalization table we know what project we're on
1:28 and these are all the IDs that are maintainers of it. And we can do super nice queries down into this list and all sorts of stuff like that.
1:35 So we're not leveraging too much among it to be here but here's one interesting part of it right there. Right, so that's all the other entities
1:43 that we might want to work with.

Talk Python's Mastodon Michael Kennedy's Mastodon