#100DaysOfWeb in Python Transcripts
Chapter: Days 33-36: Database access with SQLAlchemy
Lecture: Scooter share data model
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Let's talk about how we might model our data even what things we're storing about our scooter start-up. Here's my proposed model for this
0:09
particular adventure we're on here. We're going to have four main items that we're going to store in our database.
0:15
We're going to have scooters and we're going to have users. Those are the two primary things, I guess. And then we're going to have rentals
0:22
which is really the user getting that scooter for a period of time and then returning it. And then we have locations where the scooters can be parked.
0:30
And the users can either pick them up or drop them off. And that's it. You can see the relationships here. The user creates a rental
0:37
the rental links over to the scooter. The scooter may be parked at a location. So we're going to have foreign key relationships
0:43
in our database to link these things. That's the relational part of the relational database. And then the rentals could also be
0:51
picked up at a particular location. Pretty simple data model. I tried to keep it not overly complex. Obviously in the real world we'd probably have
1:00
20 or 30 tables, you know, with ecommerce history and auditing and all kinds of stuff. For what we're doing, I think this is going to be
1:07
complex enough to give you a real world feel of what we're building but not so complicated that you get lost in all the details.