Skip to content

SQLAlchemy

A Python toolkit for talking to SQL databases, from raw SQL to full object mapping.

Stars
12.3k
Forks
1.8k
Licence
MIT
Language
Python
Last update
5 days ago
Type
Library

What it is

SQLAlchemy is a Python library for working with relational databases. It offers a SQL toolkit for building queries in Python code and an object-relational mapper (ORM) that lets you work with database rows as Python objects. Developers use it to keep database access organized and portable across database engines.

  • Define database tables as Python classes and query them as objects
  • Build SQL queries programmatically instead of concatenating strings
  • Run the same application code against different supported SQL databases

Great for

  • Python developers building applications backed by a SQL database
  • Teams that want control over the SQL their code produces
  • Projects that may need to switch between database engines

Not ideal for

  • People who only need a simple key-value or document store, since it is built for relational databases
  • Non-Python projects, since it is a Python library
  • Complete beginners with no SQL or Python background, as the README gives no beginner tutorial
Step-by-step guide: how to use SQLAlchemyInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python 3.11 or newer (inferred from available wheel builds)

    Install from PyPI

    pip install sqlalchemy
  2. 2

    Run it

    • Install the package with pip
    • Create an engine pointing at your database
    • Define a table or model and run a query against it
  3. 3

    Get the most out of it

    • Read the official documentation at https://www.sqlalchemy.org for tutorials and reference
    • Use the ORM for object-style access and the core toolkit for explicit SQL when needed

Downloads

Strengths

  • Widely known, with 12,272 stars and a long-running project
  • Offers both a lower-level SQL toolkit and a higher-level ORM
  • Released under the permissive MIT license

Trade-offs

  • The README provided is truncated, so detailed usage and setup could not be verified here
  • Learning both the toolkit and the ORM takes time for newcomers
  • Requires familiarity with relational database concepts

How it compares

ProjectStarsTypeLevelUpdatedBest for
sqlalchemy (this)12.3kLibraryintermediate5 days agoPython developers building applications backed by a SQL database
peewee12kLibrarybeginner6 days agoPython developers who want a lightweight ORM instead of a large framework
sqlmodel18.5kLibrarybeginner4 days agoPython developers building FastAPI applications that use a SQL database
duckdb42.7kLibrarybeginner4 days agoAnalysts who want to run SQL directly on CSV, Parquet, or JSON files
turso25.1kLibraryintermediate4 days agoDevelopers who want an embedded SQLite-compatible database in a Rust, JavaScript, Python, Java, Go, or .NET project
kysely14.3kLibraryintermediate4 days agoTypeScript developers who want SQL control without losing compile-time type checks

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.