Effective PyCharm Transcripts
Chapter: Databases
Lecture: Adding data connections
Login or
purchase this course
to watch this video and the rest of the course contents.
0:02
We have our blue_yellow.sqlite database over here and notice, it has a little database icon on it, it has nothing to do with the extension,
0:13
that has to do with PyCharm looking at it and going, oh that's a SQLite file, so that's pretty awesome,
0:18
if I create another one and just call it .sqlite you'd see it would just be like a square white file icon.
0:23
So over here on the right, we have this thing that maybe has been tempting us to pull it out and it says database,
0:30
this looks pretty awesome, we can create a new data source CMD N, we can click here, we can say data source,
0:35
we could import it from a url, but check this out I was playing with it so it went to the top, but normally it would be near the bottom,
0:44
so we've got Amazon Redshift or Azure, there is SQL server stuff, we've got, I think that's Excel, I am not sure I have never played with that,
0:54
MySQL, Oracle, PostgreSQL, SQL server, Microsoft SQL server this maybe the better choice, I actually haven't tried both these and compared them,
1:04
so there is a lot of options but we're going to choose SQLite. Now, when this comes up, you might have, right now it says driver,
1:12
SQLite serial, and that might be cool, but it's very possible that it says no drivers, click to download driver,
1:19
or maybe it's down here, it says no driver, click and download drivers, I've had that happen before, things don't really work
1:25
unless you kind of click that and it just downloads and installs super easy but you've got to make sure you open up this dialogue and check that.
1:32
So once that's done, once you have the driver in place, you could sort of skip all that, like I said,
1:38
assuming you've already downloaded the driver at some point on your machine, we can come over here and we can drop this over here
1:46
and you wait a second, it gets a little number, that means it's good, it understands stuff that's in there.
1:51
We have one schema, we can open that up and look, we have our main and we have our album, we have our track
1:56
this is the first edition of this database, first version of this database, and it only has albums and tracks,
2:02
the farther that you go in the course it gets more and more complex with users and password resets and purchases,
2:07
but this is going to be plenty good for us, we can expand this out, and here, you can see this is the database representation
2:16
of what SQLAlchemy generated; remember I said the name had a uniqueness constraint and an index, that's that little yellow thing, these are indexes,
2:24
I think the little dot means unique down here, it's just the yellow, it's index, here are some things that are neither index nor unique
2:34
and you can see down here these are the actual indexes and so on, and this one primary key, there is a little baby key
2:41
so we can go and look at track as well, here's album id, there is a foreign key relationship, that's blue
2:46
here's a primary key, that's yellow and so on. So this is pretty awesome and you can see that we've added this database here
2:53
and we can go and do a bunch of stuff at it, we can view it in diagrams to try to understand it, we can edit it, we can query it, all sorts of stuff.