#100DaysOfWeb in Python Transcripts
Chapter: Days 33-36: Database access with SQLAlchemy
Lecture: Scooter share data model
0:00 Let's talk about how we might model our data
0:02 even what things we're storing about our scooter start-up.
0:06 Here's my proposed model for this
0:08 particular adventure we're on here.
0:11 We're going to have four main items
0:13 that we're going to store in our database.
0:14 We're going to have scooters and we're going to have users.
0:17 Those are the two primary things, I guess.
0:20 And then we're going to have rentals
0:21 which is really the user getting that scooter
0:24 for a period of time and then returning it.
0:26 And then we have locations where the scooters can be parked.
0:29 And the users can either pick them up or drop them off.
0:32 And that's it.
0:33 You can see the relationships here.
0:34 The user creates a rental
0:36 the rental links over to the scooter.
0:38 The scooter may be parked at a location.
0:40 So we're going to have foreign key relationships
0:42 in our database to link these things.
0:45 That's the relational part of the relational database.
0:48 And then the rentals could also be
0:50 picked up at a particular location.
0:53 Pretty simple data model.
0:54 I tried to keep it not overly complex.
0:57 Obviously in the real world we'd probably have
0:59 20 or 30 tables, you know, with ecommerce history
1:01 and auditing and all kinds of stuff.
1:04 For what we're doing, I think this is going to be
1:06 complex enough to give you a real world feel
1:08 of what we're building but not so complicated
1:10 that you get lost in all the details.