How To Install python-sqlalchemy on Ubuntu 20.04

In this tutorial we learn how to install python-sqlalchemy on Ubuntu 20.04. python-sqlalchemy is SQL toolkit and Object Relational Mapper for Python

Introduction

In this tutorial we learn how to install python-sqlalchemy on Ubuntu 20.04.

What is python-sqlalchemy

python-sqlalchemy is:

SQLAlchemy is an SQL database abstraction library for Python. Its strengths are:

  • full power and flexibility of SQL. SQLAlchemy provides a full suite of well known enterprise-level persistence patterns, designed for efficient and high-performing database access, adapted into a simple and Pythonic domain language.
  • extremely easy to use for all the basic tasks, such as: accessing pooled connections, constructing SQL from Python expressions, finding object instances, and committing object modifications back to the database.
  • powerful enough for complicated tasks, such as: eager load a graph of objects and their dependencies via joins; map recursive adjacency structures automatically; map objects to not just tables but to any arbitrary join or select statement; combine multiple tables together to load whole sets of otherwise unrelated objects from a single result set; commit entire graphs of object changes in one step.
  • built to conform to what DBAs demand, including the ability to swap out generated SQL with hand-optimized statements, full usage of bind parameters for all literal values, fully transactionalized and consistent updates using Unit of Work.
  • modular. Different parts of SQLAlchemy can be used independently of the rest, including the connection pool, SQL construction, and ORM. SQLAlchemy is constructed in an open style that allows plenty of customization, with an architecture that supports custom datatypes, custom SQL extensions, and ORM plugins which can augment or extend mapping functionality.

There are three methods to install python-sqlalchemy on Ubuntu 20.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-sqlalchemy Using apt-get

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

sudo apt-get update

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

sudo apt-get -y install python-sqlalchemy

Install python-sqlalchemy Using apt

Update apt database with apt using the following command.

sudo apt update

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

sudo apt -y install python-sqlalchemy

Install python-sqlalchemy 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 Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

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

sudo aptitude -y install python-sqlalchemy

How To Uninstall python-sqlalchemy on Ubuntu 20.04

To uninstall only the python-sqlalchemy package we can use the following command:

sudo apt-get remove python-sqlalchemy

Uninstall python-sqlalchemy And Its Dependencies

To uninstall python-sqlalchemy and its dependencies that are no longer needed by Ubuntu 20.04, we can use the command below:

sudo apt-get -y autoremove python-sqlalchemy

Remove python-sqlalchemy Configurations and Data

To remove python-sqlalchemy configuration and data from Ubuntu 20.04 we can use the following command:

sudo apt-get -y purge python-sqlalchemy

Remove python-sqlalchemy configuration, data, and all of its dependencies

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

sudo apt-get -y autoremove --purge python-sqlalchemy

References

Summary

In this tutorial we learn how to install python-sqlalchemy package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.