
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
- 4 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
How to get it
- 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
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
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
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| sqlalchemy (this) | 12.3k | Library | intermediate | 4 days ago | Python developers building applications backed by a SQL database |
| peewee | 12k | Library | beginner | 5 days ago | Python developers who want a lightweight ORM instead of a large framework |
| sqlmodel | 18.5k | Library | beginner | 4 days ago | Python developers building FastAPI applications that use a SQL database |
| duckdb | 42.7k | Library | beginner | 4 days ago | Analysts who want to run SQL directly on CSV, Parquet, or JSON files |
| turso | 25.1k | Library | intermediate | 4 days ago | Developers who want an embedded SQLite-compatible database in a Rust, JavaScript, Python, Java, Go, or .NET project |
| kysely | 14.3k | Library | intermediate | 4 days ago | TypeScript 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.