Communicating with a SQL database with SQLAlchemy
To begin, we'll discuss how to work with a relational database using the SQLAlchemy library. SQLAlchemy has been around for years and is the most popular library in Python when you wish to work with SQL databases.
In this chapter, it's worth noting that we'll only consider the core part of the library, which only provides the tools to abstract communication with a SQL database. We won't consider the ORM part, as, in the next section, we'll focus on another ORM: Tortoise. As such, in this section, we'll pay very close attention to the SQL language.
Recently, async support has been added in version 1.4 but is not yet considered stable. That's why, for now, we'll combine it with the databases library by Encode, the same team behind Starlette, which provides an asynchronous connection layer for SQLAlchemy. In Figure 6.3, we have presented a schema for you to better visualize the interaction...