Using GINO for async transactions
GINO, which stands for GINO Is Not ORM, is a lightweight asynchronous ORM that runs on top of an SQLAlchemy Core and AsyncIO environment. All its APIs are asynchronous-ready so that you can build contextual database connections and transactions. It has built-in JSONB support so that it can convert its results into JSON objects. But there is one catch: GINO only supports PostgreSQL databases.
While creating the gym fitness project, the only available stable GINO version is 1.0.1, which requires SQLAlchemy 1.3. Therefore, installing GINO will automatically uninstall SQLAlchemy 1.4, thus adding the GINO repository to the ch05a
project to avoid any conflicts with the async version of SQLAlchemy.
You can use the following command to install the latest version of GINO:
pip install gino
Installing the database driver
Since the only RDBMS it supports is PostgreSQL, you only need to install asyncpg
using the pip
command.