#100DaysOfCode in Python Transcripts
Chapter: Days 91-93: Database access with SQLAlchemy
Lecture: Introducing SQLAlchemy
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Are you ready to have some fun playing with the database?
0:03
Well, we're going to talk about an
0:04
amazing technology called SQLAlchemy.
0:07
And this is probably the best way,
0:09
and also, probably the most popular way
0:12
to access relational databases.
0:15
Previously, you learned about SQLite,
0:17
and SQLAlchemy will of course talk to SQLite,
0:20
but it'll talk to all kinds of databases.
0:23
You can find it at SQLAlchemy.org.
0:26
It's an object relational mapper.
0:28
So when we saw SQLite before, you just created strings,
0:31
and you said, "Create this table,"
0:33
or, "Select this from wherever."
0:36
You would write in line SQL, and that was tied to SQLite.
0:40
Well, SQLAlchemy works in a much higher level.
0:42
What we're going to do is we're going to create classes,
0:44
and we're going to model the database shape in our classes.
0:49
SQLAlchemy will actually even create
0:51
the database from the classes, alright?
0:53
So this is really, really powerful.
0:55
We can point at almost any relational database,
0:57
and then we work in these high level Python constructs,
1:00
making it very, very easy for us to write the code.
1:03
We don't have to think in the SQL query language,
1:05
we just think in Python, and it just works.
1:08
It's up to SQLAlchemy to convert that
1:10
to the SQL query language.
1:12
It's really, really easy to get started.
1:14
It's extremely flexible and powerful.
1:16
And we're going to have a lot of fun building an app with it.