How To Install python3-sqlmodel on Debian 12

Learn how to install python3-sqlmodel on Debian 12 with this tutorial. python3-sqlmodel is SQL databases in Python, designed for simplicity, compatibility, and robustness

Introduction

In this tutorial we learn how to install python3-sqlmodel on Debian 12.

What is python3-sqlmodel

python3-sqlmodel is:

SQLModel is a library for interacting with SQL databases from Python code, with Python objects. It is designed to be intuitive, easy to use, highly compatible, and robust.

SQLModel is based on Python type annotations, and powered by Pydantic and SQLAlchemy.

The key features are:

  • Intuitive to write: Great editor support. Completion everywhere. Less time debugging. Designed to be easy to use and learn. Less time reading docs.
  • Easy to use: It has sensible defaults and does a lot of work underneath to simplify the code you write.
  • Compatible: It is designed to be compatible with FastAPI, Pydantic, and SQLAlchemy.
  • Extensible: You have all the power of SQLAlchemy and Pydantic underneath.
  • Short: Minimize code duplication. A single type annotation does a lot of work. No need to duplicate models in SQLAlchemy and Pydantic.

SQLModel is designed to simplify interacting with SQL databases in FastAPI applications, it was created by the same author.

It combines SQLAlchemy and Pydantic and tries to simplify the code you write as much as possible, allowing you to reduce the code duplication to a minimum, but while getting the best developer experience possible.

SQLModel is, in fact, a thin layer on top of Pydantic and SQLAlchemy, carefully designed to be compatible with both.

There are three methods to install python3-sqlmodel on Debian 12. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python3-sqlmodel Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python3-sqlmodel using apt-get by running the following command:

sudo apt-get -y install python3-sqlmodel

Install python3-sqlmodel Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python3-sqlmodel using apt by running the following command:

sudo apt -y install python3-sqlmodel

Install python3-sqlmodel Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python3-sqlmodel using aptitude by running the following command:

sudo aptitude -y install python3-sqlmodel

How To Uninstall python3-sqlmodel on Debian 12

To uninstall only the python3-sqlmodel package we can use the following command:

sudo apt-get remove python3-sqlmodel

Uninstall python3-sqlmodel And Its Dependencies

To uninstall python3-sqlmodel and its dependencies that are no longer needed by Debian 12, we can use the command below:

sudo apt-get -y autoremove python3-sqlmodel

Remove python3-sqlmodel Configurations and Data

To remove python3-sqlmodel configuration and data from Debian 12 we can use the following command:

sudo apt-get -y purge python3-sqlmodel

Remove python3-sqlmodel configuration, data, and all of its dependencies

We can use the following command to remove python3-sqlmodel configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python3-sqlmodel

Dependencies

python3-sqlmodel have the following dependencies:

References

Summary

In this tutorial we learn how to install python3-sqlmodel package on Debian 12 using different package management tools: apt, apt-get and aptitude.