Mastering PyCharm Transcripts
Lecture: Database diagrams
0:01 There are a lot of things we could focus on first
0:03 as we start to explore the data— querying it, modifying it and so on.
0:06 But let's start by trying to understand the data
0:10 and a picture is really often worth a thousand words or something like that,
0:15 so you'll see that we can actually do some pretty cool things.
0:19 I could come over here and right click on track and say show me a diagram,
0:24 or I could do better, I could actually click on a group of schemas
0:28 or the whole database and say show me the diagram,
0:31 and I get two options, one is a straight up visualization,
0:34 another is what's called a visualization pop up
0:36 let's do the straight normal visualization first.
0:39 Look at this, how awesome is that?
0:42 So I told you that is this foreign key from album id over to id
0:46 and look, there it is, visually.
0:49 We got SQLite in this master here, we don't really need that,
0:52 I'll take that off of our diagram we put these up next to each other,
0:56 it's kind of funky the way that maps over,
0:59 but nonetheless, we can see this relationship
1:01 and it's not a huge deal in this kind of simple little thing
1:04 but if this was really complicated, this would be very helpful for us
1:08 understanding how things relate,
1:10 what the relationships are that we can navigate and things like that.
1:13 It actually helps a lot that we have SQLAlchemy
1:16 because we can come over here and look at this as well
1:18 and it will tell us a little bit about— well, it will tell us a lot
1:21 but you know, only one table at a time,
1:24 it will tell us a lot about what's in here,
1:27 but even so, seeing the big picture is really, really nice
1:30 and so these diagrams I think they're great.
1:32 Now, this is the sort of tabbed version,
1:35 so sometimes you don't want to necessarily open up another tab
1:38 and have a little file, so you can just do
1:41 like a quick little peak if you will with this pop up,
1:43 and here we have just this little quick pop up to remind you
1:46 what the relationship of these things are.
1:48 It's kind of hard to wrap your mind around it
1:51 like if this was actually complicated there might be 50 tables
1:53 you have to imagine this is complicated,
1:56 but you saw when we did show us all these, this little pop up
1:59 we got everything, including the little master
2:03 maybe we want to just focus our attention
2:06 on the relationships between just a few classes right,
2:08 again, this is so simple, it didn't really matter
2:11 but if you had many, you could focus on three or four tables
2:14 which seems pretty reasonable,
2:16 highlight them and say show us the diagram,
2:18 and now only those tables are included in the diagram.
2:21 This is really sweet, I love this feature
2:23 it's really nice for both documenting and sharing the schema
2:26 that you're using your data models with other developers
2:29 and maybe in some form of documentation.