Full Web Apps with FastAPI Transcripts
Chapter: async databases with SQLAlchemy
Lecture: Intro to chapter
0:00 Welcome to the async SQLAlchemy chapter. I'm so excited to finally be presenting this part of the course to
0:07 you. We've been building towards this for a long, long time, and I'm so excited because this is how we're going to take advantage
0:14 of one of the most powerful features for creating truly high performance web applications with Python. Async and await,
0:21 one of the reasons I love FastAPI so much is it makes it really, really simple and straightforward to create async
0:28 web applications, you simply use the cool async and await keywords that come with Python, and it handles the rest at the infrastructure level.
0:37 We can have async and non async code mixed together in different view methods or different API methods, and it just knows how to treat
0:44 one as async and one as a regular web method, but in order to take advantage of that,
0:49 we have to have async for all the external systems we're waiting on. If we're calling an API,
0:55 we need to use some kind of client that understands how to do that
0:58 asynchronously and importantly, one of the biggest things, the biggest systems we wait on in web applications is the database.
1:05 In fact, many web applications, I would say, do more processing or computation, spend more
1:11 of their time in the data base layer than they do in the actual web layer And with async and await we can take all that time we spend
1:18 in the database and just completely free it up to do way more web processing. So this is really, really a key piece of the advantage of FastAPI
1:28 and we're gonna dig into it now. It's gonna be awesome.