Akron ORM Documentation

Complete guide to using Akron ORM - the universal Python ORM supporting SQLite, MySQL, PostgreSQL, and MongoDB with a unified API.

Welcome to Akron ORM

A universal Python ORM that provides a consistent, type-safe API across SQLite, MySQL, PostgreSQL, and MongoDB. Build database applications with confidence and flexibility.

🚀 Quick Start

1# Install Akron
2pip install akron
3
4# Import and connect
5from akron import Akron
6
7# Works with any database
8db = Akron("sqlite:///myapp.db")
9
10# Create tables
11db.create_table("users", {
12 "id": "int",
13 "username": "str",
14 "email": "str"
15})
16
17# Insert data
18user_id = db.insert("users", {
19 "username": "alice",
20 "email": "alice@example.com"
21})
22
23# Query data
24users = db.find("users", {"username": "alice"})
25print(f"Found user: {users[0]}")
26
27db.close()
Expected Output
Found user: {'id': 1, 'username': 'alice', 'email': 'alice@example.com'}

🆕 New: Declarative Schema Management

Akron now features powerful declarative schema management with automatic migrations!

1# Initialize a new project with schema template
2akron db init --provider sqlite
3
4# Edit the generated akron.json to define your schema
5# Generate migrations from schema changes
6akron db makemigrations --name "initial"
7
8# Apply migrations to database
9akron db migrate
10
11# Check status
12akron db status

Documentation Sections

API Methods Quick Reference

Supported Databases

🗄️

SQLite

File-based database

sqlite:///app.db
🐬

MySQL

Popular web database

mysql://user:pass@host/db
🐘

PostgreSQL

Advanced SQL features

postgres://user:pass@host/db
🍃

MongoDB

Document database

mongodb://host:port/db

Key Features

Universal API

Same code works across SQLite, MySQL, PostgreSQL, and MongoDB.

Type Safety

Built-in Pydantic integration for automatic data validation.

Easy Migration

Switch between databases with minimal code changes.

CLI Tools

Powerful command-line interface for schema management.

Production Ready

Connection pooling, error handling, and transaction support.

Zero Dependencies

Minimal footprint with optional database drivers.

Community & Support

GitHub

Source code, issues, and contributions

View Repository →

Documentation

Comprehensive guides and examples

Get Started →

Package

Install via PyPI package manager

View on PyPI →