akron


Nameakron JSON
Version 0.2.3 PyPI version JSON
download
home_pagehttps://github.com/Akash-nath29/akron
SummaryUniversal, framework-independent ORM for Python.
upload_time2025-09-12 07:36:58
maintainerNone
docs_urlNone
authorAkash Nath
requires_python>=3.7
licenseMIT
keywords orm database sql nosql sqlite mysql postgres mongodb
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
	<img src="https://res.cloudinary.com/dclp2h92a/image/upload/v1756577773/ChatGPT_Image_Aug_30_2025_11_01_26_PM_i6o5k7.png" alt="Akron ORM Logo" width="180"/>
</p>

# Akron

**Universal, framework-independent ORM for Python** ๐Ÿš€

Akron is a modern Python ORM that provides a unified interface for working with multiple databases. Whether you're using SQLite, MySQL, PostgreSQL, or MongoDB, Akron gives you the same clean, type-safe API across all platforms.

[![PyPI version](https://badge.fury.io/py/akron.svg)](https://pypi.org/project/akron/)
[![Python 3.7+](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

---

## โœจ Key Features

### Core Capabilities
- **๐Ÿ”„ Universal Database Support** - One API for SQLite, MySQL, PostgreSQL, and MongoDB
- **๐Ÿ›ก๏ธ Type Safety** - Full Pydantic integration for type-safe models and validation
- **๐Ÿ”ง Zero Configuration** - Works out of the box with simple connection strings
- **๏ฟฝ Framework Independent** - Works with any Python framework or standalone scripts

### Advanced ORM Features
- **๐Ÿ“Š Advanced Querying** - QueryBuilder with filtering, sorting, pagination, and joins
- **๐Ÿ” Smart Operators** - Support for `gt`, `lt`, `in`, `like`, `isnull` and more
- **๐Ÿ“ˆ Aggregations** - Built-in `sum`, `count`, `avg`, `min`, `max` with GROUP BY
- **๐Ÿ”„ Transactions** - Context managers and manual transaction control
- **โšก Bulk Operations** - Efficient bulk insert, update, and delete operations
- **๐Ÿ—‚๏ธ Indexing** - Create and manage database indexes for performance
- **๐Ÿ”— Relationships** - Foreign key constraints and multi-table operations
- **๏ฟฝ๏ธ Raw SQL** - Execute custom SQL when needed
- **๐Ÿ’พ Serialization** - Convert results to JSON and dictionaries

### Developer Experience
- **๐Ÿ“ฆ Schema Management** - Declarative schema with automatic migrations via `akron.json`
- **โšก CLI Tools** - Modern command-line interface (`akron db init`, `migrate`, etc.)
- **๐Ÿงช Well Tested** - Comprehensive test coverage across all database drivers
- **๏ฟฝ Rich Documentation** - Complete guides and examples for all features

---

## ๐Ÿš€ Quick Start

### Installation

```bash
pip install akron
```

### Basic Usage

```python
from akron import Akron

# Initialize database connection
db = Akron("sqlite:///example.db")

# Create table with relationships
db.create_table("users", {
    "id": "int",
    "name": "str", 
    "email": "str",
    "age": "int",
    "active": "bool"
})

db.create_table("posts", {
    "id": "int",
    "title": "str",
    "content": "str",
    "user_id": "int->users.id",  # Foreign key to users table
    "published": "bool"
})

# Insert data
user_id = db.insert("users", {
    "name": "Alice Johnson",
    "email": "alice@example.com", 
    "age": 28,
    "active": True
})

# Bulk insert
post_ids = db.bulk_insert("posts", [
    {"title": "Hello World", "content": "My first post", "user_id": user_id, "published": True},
    {"title": "Python Tips", "content": "Some useful tips", "user_id": user_id, "published": False}
])

# Advanced querying with QueryBuilder
published_posts = db.query("posts").where(
    published=True,
    user_id=user_id
).order_by("-created_at").limit(10).all()

# Find with operators
young_users = db.query("users").where(age__lt=30, active=True).all()

# Aggregations
user_stats = db.aggregate("posts", {
    "post_count": "count",
    "avg_views": "avg"
}, group_by=["user_id"])

# Transactions
with db.transaction():
    new_user_id = db.insert("users", {"name": "Bob", "email": "bob@example.com", "age": 25, "active": True})
    db.insert("posts", {"title": "Bob's First Post", "user_id": new_user_id, "published": True})

# Count and existence checks
total_users = db.count("users")
has_admin = db.exists("users", {"email": "admin@example.com"})

# Raw SQL for complex queries
user_post_stats = db.raw("""
    SELECT u.name, COUNT(p.id) as post_count
    FROM users u LEFT JOIN posts p ON u.id = p.user_id
    GROUP BY u.id, u.name
    ORDER BY post_count DESC
""")

# Close connection
db.close()
```

### Type-Safe Models with Pydantic

```python
from pydantic import BaseModel
from akron import Akron
from akron.models import ModelMixin

class User(BaseModel, ModelMixin):
    id: int
    name: str
    email: str
    age: int
    is_active: bool = True

# Initialize database
db = Akron("sqlite:///users.db")

# Create table from model
User.create_table(db)

# Insert with type safety
new_user = User(id=1, name="Bob Smith", email="bob@example.com", age=25)
User.insert(db, new_user)

# Query with automatic deserialization
users = User.find(db)  # Returns List[User]
active_users = User.find(db, {"is_active": True})

# Update and delete
User.update(db, {"id": 1}, {"age": 26})
User.delete(db, {"email": "bob@example.com"})
```

---

## ๐Ÿ—„๏ธ Database Support

| Database    | Connection String Example | CRUD | Foreign Keys | Migrations | CLI Support |
|-------------|---------------------------|------|--------------|------------|-------------|
| **SQLite**  | `sqlite:///path/to/db.db` | โœ…   | โœ…           | โœ…         | โœ…          |
| **MySQL**   | `mysql://user:pass@host:port/dbname` | โœ…   | โœ…           | โœ…         | โœ…          |
| **PostgreSQL** | `postgres://user:pass@host:port/dbname` | โœ…   | โœ…           | โœ…         | โœ…          |
| **MongoDB** | `mongodb://host:port/dbname` | โœ…   | โŒ*          | Schemaless | โœ…          |

*MongoDB doesn't support traditional foreign keys but maintains the same API for document references.

### Connection Examples

```python
# SQLite (file-based)
db = Akron("sqlite:///myapp.db")

# SQLite (in-memory)
db = Akron("sqlite:///:memory:")

# MySQL
db = Akron("mysql://username:password@localhost:3306/mydatabase")

# PostgreSQL
db = Akron("postgres://username:password@localhost:5432/mydatabase")

# MongoDB
db = Akron("mongodb://localhost:27017/mydatabase")
```

---

## ๐Ÿ”— Advanced Features

### Foreign Key Relationships

```python
# Create tables with foreign key relationships
db.create_table("users", {
    "id": "int",
    "name": "str",
    "email": "str"
})

db.create_table("orders", {
    "id": "int",
    "user_id": "int->users.id",  # Foreign key syntax
    "product_name": "str",
    "amount": "float",
    "status": "str"
})

# Insert related data
user_id = db.insert("users", {"name": "Alice", "email": "alice@example.com"})
order_id = db.insert("orders", {
    "user_id": user_id,
    "product_name": "Laptop",
    "amount": 999.99,
    "status": "pending"
})

# Query with relationships
user_orders = db.find("orders", {"user_id": user_id})
```

### Complex Queries with QueryBuilder

```python
# Advanced filtering with operators
results = db.query("users").where(
    age__gte=25,           # age >= 25
    name__like="John%",    # name starts with "John" 
    active=True            # active = True
).order_by("-created_at").limit(10).all()

# Pagination made simple
page_1 = db.query("posts").paginate(page=1, per_page=20)
page_2 = db.query("posts").paginate(page=2, per_page=20)

# Joins and aggregations
user_stats = db.query("users").join(
    "posts", on="users.id = posts.user_id"
).select([
    "users.name",
    "COUNT(posts.id) as post_count"
]).group_by("users.id").all()

# Bulk operations for performance
db.bulk_insert("products", [
    {"name": "Product 1", "price": 19.99},
    {"name": "Product 2", "price": 29.99},
    {"name": "Product 3", "price": 39.99}
])

# Atomic transactions
with db.transaction():
    user_id = db.insert("users", {"name": "Charlie", "email": "charlie@example.com"})
    db.insert("profiles", {"user_id": user_id, "bio": "New user profile"})
    # All operations committed together or rolled back on error
```

### Performance and Indexing

```python
# Create indexes for faster queries
db.create_index("users", ["email"])        # Single column index
db.create_index("orders", ["user_id", "status"])  # Composite index

# Performance optimization with exists()
if db.exists("users", {"email": "admin@example.com"}):
    print("Admin user found")

# Count records efficiently
total_active_users = db.count("users", {"active": True})

# Raw SQL for complex operations
results = db.raw("""
    SELECT category, AVG(price) as avg_price, COUNT(*) as item_count
    FROM products 
    WHERE active = 1
    GROUP BY category
    HAVING COUNT(*) > 5
    ORDER BY avg_price DESC
""")
```

### Pydantic Model Relationships

```python
class User(BaseModel, ModelMixin):
    id: int
    name: str
    email: str
    age: int

class Order(BaseModel, ModelMixin):
    id: int
    user_id: int  # Foreign key reference
    product_name: str
    amount: float
    status: str

# Create tables
User.create_table(db)
Order.create_table(db)

# Work with related models
user = User(id=1, name="Charlie", email="charlie@example.com", age=30)
User.insert(db, user)

order = Order(id=1, user_id=1, product_name="Book", amount=24.99, status="shipped")
Order.insert(db, order)

# Query relationships
user_orders = Order.find(db, {"user_id": 1})
```

---

## ๐Ÿ”„ Schema Management (Prisma-like)

Akron now supports Prisma-like schema management with `akron.json` configuration files:

### Initialize a New Project

```bash
# Initialize with SQLite (default)
akron db init

# Initialize with specific database
akron db init --provider postgresql --url "postgres://user:pass@localhost:5432/mydb"
akron db init --provider mysql --url "mysql://user:pass@localhost:3306/mydb"
akron db init --provider mongodb --url "mongodb://localhost:27017/mydb"
```

### Define Your Schema

Edit the generated `akron.json` file:

```json
{
  "database": {
    "provider": "sqlite",
    "url": "sqlite:///app.db"
  },
  "tables": {
    "users": {
      "columns": {
        "id": {
          "type": "int",
          "primary_key": true,
          "auto_increment": true
        },
        "email": {
          "type": "str",
          "unique": true,
          "nullable": false
        },
        "username": {
          "type": "str",
          "unique": true,
          "nullable": false,
          "max_length": 50
        },
        "created_at": {
          "type": "datetime",
          "default": "CURRENT_TIMESTAMP"
        }
      }
    },
    "posts": {
      "columns": {
        "id": {
          "type": "int",
          "primary_key": true,
          "auto_increment": true
        },
        "title": {
          "type": "str",
          "nullable": false,
          "max_length": 200
        },
        "content": {
          "type": "text",
          "nullable": true
        },
        "author_id": {
          "type": "int",
          "nullable": false
        },
        "published": {
          "type": "bool",
          "default": false
        }
      },
      "foreign_keys": {
        "author_id": {
          "references": "users",
          "column": "id",
          "on_delete": "CASCADE"
        }
      }
    }
  }
}
```

### Generate and Apply Migrations

```bash
# Generate migrations from schema changes
akron db makemigrations --name "add_user_posts"

# Preview what will be migrated
akron db migrate --dry-run

# Apply migrations
akron db migrate

# Check migration status
akron db status
```

### Schema Management Workflow

1. **Initialize**: `akron db init` creates `akron.json` and `.akron/` directory
2. **Define**: Edit `akron.json` to define your database schema
3. **Generate**: `akron db makemigrations` creates migration files
4. **Apply**: `akron db migrate` applies pending migrations
5. **Monitor**: `akron db status` shows current state

## ๐Ÿ”„ Legacy Migration System

For backward compatibility, Akron still supports the original migration commands:

### Auto-Generate Migrations

```bash
# Create a migration for schema changes
akron makemigrations users --db sqlite:///app.db --schema '{"id": "int", "name": "str", "email": "str", "created_at": "str"}'

# Apply migrations
akron migrate users --db sqlite:///app.db

# View migration history
akron showmigrations users --db sqlite:///app.db
```

### Migration Features

- **Automatic Schema Diffing** - Compares current vs target schema
- **Migration File Generation** - Creates JSON migration files in `migrations/` directory
- **Version Tracking** - Maintains migration history in `_akron_migrations` table
- **Rollback Support** - Track applied migrations for potential rollbacks

---

## ๐Ÿ› ๏ธ CLI Commands

Akron provides two command interfaces: **modern schema management** and **legacy commands**.

### Modern Schema Management Commands

```bash
# Initialize a new Akron project
akron db init                                      # SQLite default
akron db init --provider postgresql --url "..."   # PostgreSQL
akron db init --provider mysql --url "..."        # MySQL
akron db init --provider mongodb --url "..."      # MongoDB

# Generate migrations from schema changes
akron db makemigrations                            # Auto-named migration
akron db makemigrations --name "add_user_table"   # Custom name

# Apply migrations
akron db migrate                                   # Apply all pending
akron db migrate --dry-run                        # Preview changes

# Check status
akron db status                                    # Show schema and migration status

# Reset database (planned)
akron db reset --force                            # Drop all and reapply
```

### Legacy Commands (Backward Compatibility)

```bash
# Table Management
akron create-table users --db sqlite:///app.db --schema '{"id": "int", "name": "str"}'
akron drop-table users --db sqlite:///app.db
akron inspect-schema users --db sqlite:///app.db

# Data Management
akron seed users --db sqlite:///app.db --data '{"name": "John", "email": "john@example.com"}'
akron raw-sql --db sqlite:///app.db --sql "SELECT COUNT(*) FROM users"

# Legacy Migration Commands
akron makemigrations orders --db mysql://user:pass@localhost/shop --schema '{"id": "int"}'
akron migrate orders --db mysql://user:pass@localhost/shop
akron showmigrations orders --db mysql://user:pass@localhost/shop
```

---

## ๐Ÿ“Š Type System

Akron provides a flexible type system that maps Python types to database-specific types:

### Supported Python Types

| Python Type | SQL Databases | MongoDB |
|-------------|---------------|---------|
| `int`       | INTEGER       | Number  |
| `str`       | VARCHAR/TEXT  | String  |
| `float`     | REAL/DOUBLE   | Number  |
| `bool`      | BOOLEAN       | Boolean |

### Custom Type Mapping

```python
# Define custom field types in Pydantic models
from pydantic import Field
from datetime import datetime

class User(BaseModel, ModelMixin):
    id: int
    name: str
    email: str = Field(..., max_length=255)
    age: int = Field(..., ge=0, le=150)
    created_at: str  # Store as ISO string
    is_premium: bool = False
```

---

## ๐Ÿ”ง Configuration & Best Practices

### Connection Pooling

```python
# For production use, consider connection pooling
class DatabaseManager:
    def __init__(self, db_url: str):
        self.db_url = db_url
        self._db = None
    
    def get_db(self):
        if self._db is None:
            self._db = Akron(self.db_url)
        return self._db
    
    def close(self):
        if self._db:
            self._db.close()
            self._db = None

# Usage
db_manager = DatabaseManager("sqlite:///app.db")
db = db_manager.get_db()
```

### Error Handling

```python
from akron.exceptions import AkronError, TableNotFoundError, SchemaError

try:
    db = Akron("sqlite:///myapp.db")
    users = db.find("nonexistent_table")
except TableNotFoundError:
    print("Table doesn't exist - creating it...")
    db.create_table("users", {"id": "int", "name": "str"})
except AkronError as e:
    print(f"Database error: {e}")
```

### Environment-Based Configuration

```python
import os
from akron import Akron

# Use environment variables for database configuration
DATABASE_URL = os.getenv(
    "DATABASE_URL", 
    "sqlite:///default.db"  # fallback for development
)

db = Akron(DATABASE_URL)
```

---

## ๐Ÿงช Testing

Akron includes comprehensive test coverage and provides utilities for testing:

### Test Database Setup

```python
import pytest
from akron import Akron
from akron.models import ModelMixin
from pydantic import BaseModel

class User(BaseModel, ModelMixin):
    id: int
    name: str
    email: str

@pytest.fixture
def test_db():
    # Use in-memory database for testing
    db = Akron("sqlite:///:memory:")
    User.create_table(db)
    yield db
    db.close()

def test_user_creation(test_db):
    user = User(id=1, name="Test User", email="test@example.com")
    User.insert(test_db, user)
    
    users = User.find(test_db, {"email": "test@example.com"})
    assert len(users) == 1
    assert users[0].name == "Test User"
```

### Running Tests

```bash
# Run the full test suite
pytest tests/

# Run specific database tests
pytest tests/test_sqlite_pytest.py
pytest tests/test_mysql_pytest.py
```

---

## ๐Ÿ“ˆ Performance Considerations

### Batch Operations

```python
# For large datasets, consider batch insertions
users_data = [
    {"name": f"User {i}", "email": f"user{i}@example.com", "age": 20 + i}
    for i in range(1000)
]

for user_data in users_data:
    db.insert("users", user_data)
```

### Connection Management

```python
# Always close connections in production
try:
    db = Akron("mysql://user:pass@localhost/prod_db")
    # ... database operations ...
finally:
    db.close()

# Or use context managers (if implementing __enter__/__exit__)
```

---

## ๐Ÿ” Examples

Check out the `examples/` directory for more comprehensive examples:

- `basic_crud.py` - Basic CRUD operations
- `sqlite_multi_table.py` - Multi-table relationships with SQLite
- `postgres_multi_table.py` - PostgreSQL with foreign keys

---

## ๐Ÿ†š Version Information

- **Current Version**: v0.1.5
- **Python Requirements**: Python 3.7+
- **Dependencies**: 
  - `pydantic` - Type safety and validation
  - `mysql-connector-python` - MySQL support
  - `psycopg2` - PostgreSQL support  
  - `pymongo` - MongoDB support

### Changelog

See [CHANGELOG.md](CHANGELOG.md) for detailed version history and updates.

---

## ๐Ÿ“š Quick Reference

### Essential Operations Cheat Sheet

```python
# Basic CRUD
db.insert("table", {"field": "value"})
db.find("table", {"field": "value"})  
db.update("table", {"id": 1}, {"field": "new_value"})
db.delete("table", {"field": "value"})

# Advanced Querying  
db.query("table").where(age__gte=25, active=True).order_by("-created_at").limit(10).all()
db.query("table").paginate(page=1, per_page=20)

# Aggregations
db.count("table", {"active": True})
db.aggregate("table", {"total": "sum", "avg_price": "avg"})

# Bulk Operations
db.bulk_insert("table", [{"name": "A"}, {"name": "B"}])
db.bulk_update("table", {"active": False}, {"status": "inactive"})

# Transactions
with db.transaction():
    # Multiple operations here

# Performance
db.exists("table", {"email": "user@example.com"})
db.create_index("table", ["email", "status"])
db.raw("SELECT * FROM table WHERE custom_condition")
```

### QueryBuilder Operators

| Operator | Example | SQL Equivalent |
|----------|---------|----------------|
| `field` | `where(age=25)` | `WHERE age = 25` |
| `field__gt` | `where(age__gt=18)` | `WHERE age > 18` |
| `field__gte` | `where(age__gte=18)` | `WHERE age >= 18` |
| `field__lt` | `where(age__lt=65)` | `WHERE age < 65` |
| `field__lte` | `where(age__lte=65)` | `WHERE age <= 65` |
| `field__in` | `where(status__in=["active", "pending"])` | `WHERE status IN (...)` |
| `field__like` | `where(name__like="John%")` | `WHERE name LIKE 'John%'` |
| `field__isnull` | `where(deleted_at__isnull=True)` | `WHERE deleted_at IS NULL` |

---

## ๐Ÿค Contributing

We welcome contributions! Please feel free to:

1. **Report Issues** - Found a bug? Let us know!
2. **Feature Requests** - Have an idea? We'd love to hear it!
3. **Pull Requests** - Code contributions are always welcome!

### Development Setup

```bash
# Clone the repository
git clone https://github.com/Akash-nath29/akron.git
cd akron

# Install development dependencies
pip install -e .
pip install pytest

# Run tests
pytest tests/
```

---

## ๐Ÿ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

## ๐Ÿ”— Links

- **PyPI Package**: https://pypi.org/project/akron/
- **GitHub Repository**: https://github.com/Akash-nath29/akron
- **Documentation**: https://akron-website.vercel.app/docs
- **Issues & Support**: https://github.com/Akash-nath29/akron/issues

---

<div align="center">

**Made with โค๏ธ by the Akron team**

โญ **Star us on GitHub if you find Akron useful!** โญ

</div>

---

## ๐Ÿ”„ Transactions & Atomic Operations

**Transactions** let you group multiple database operations into a single, all-or-nothing unit. This means either *all* changes succeed together, or *none* are applied if something fails. This is essential for keeping your data safe and consistent.

### Why Use Transactions?
- **Data Integrity:** Prevents partial updates and keeps your database consistent.
- **Automatic Rollback:** If any operation fails, all changes are undone automatically.
- **Business Logic:** Ensures complex operations (like money transfers, order processing) are atomic.

### Example Usage
```python
with db.transaction():
    user_id = db.insert("users", {"name": "Alice"})
    db.insert("profiles", {"user_id": user_id})
    # If any step fails, all changes are rolled back!
```

### Real-World Scenarios
- **Money Transfer:** Deduct from one account, add to another, log the transaction. If any step fails, no money is lost.
- **Order Processing:** Charge customer, reduce inventory, create order record. If payment fails, inventory isn&apos;t reduced.
- **User Registration:** Create account, profile, send email. If any step fails, no partial user is created.

### How It Works
1. Akron starts a transaction when you enter the `with db.transaction()` block.
2. If all operations succeed, changes are committed.
3. If any operation fails, Akron automatically rolls back all changes.

### Best Practices
- Use transactions for any set of operations that must succeed together.
- Don&apos;t use transactions for simple, single-step reads or writes.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Akash-nath29/akron",
    "name": "akron",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "orm database sql nosql sqlite mysql postgres mongodb",
    "author": "Akash Nath",
    "author_email": "anath5440@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a0/dd/96ec25c660f42a736137e0553177afe1b26ba58708c45f87ce28a09ab56b/akron-0.2.3.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\r\n\t<img src=\"https://res.cloudinary.com/dclp2h92a/image/upload/v1756577773/ChatGPT_Image_Aug_30_2025_11_01_26_PM_i6o5k7.png\" alt=\"Akron ORM Logo\" width=\"180\"/>\r\n</p>\r\n\r\n# Akron\r\n\r\n**Universal, framework-independent ORM for Python** \ud83d\ude80\r\n\r\nAkron is a modern Python ORM that provides a unified interface for working with multiple databases. Whether you're using SQLite, MySQL, PostgreSQL, or MongoDB, Akron gives you the same clean, type-safe API across all platforms.\r\n\r\n[![PyPI version](https://badge.fury.io/py/akron.svg)](https://pypi.org/project/akron/)\r\n[![Python 3.7+](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\r\n\r\n---\r\n\r\n## \u2728 Key Features\r\n\r\n### Core Capabilities\r\n- **\ud83d\udd04 Universal Database Support** - One API for SQLite, MySQL, PostgreSQL, and MongoDB\r\n- **\ud83d\udee1\ufe0f Type Safety** - Full Pydantic integration for type-safe models and validation\r\n- **\ud83d\udd27 Zero Configuration** - Works out of the box with simple connection strings\r\n- **\ufffd Framework Independent** - Works with any Python framework or standalone scripts\r\n\r\n### Advanced ORM Features\r\n- **\ud83d\udcca Advanced Querying** - QueryBuilder with filtering, sorting, pagination, and joins\r\n- **\ud83d\udd0d Smart Operators** - Support for `gt`, `lt`, `in`, `like`, `isnull` and more\r\n- **\ud83d\udcc8 Aggregations** - Built-in `sum`, `count`, `avg`, `min`, `max` with GROUP BY\r\n- **\ud83d\udd04 Transactions** - Context managers and manual transaction control\r\n- **\u26a1 Bulk Operations** - Efficient bulk insert, update, and delete operations\r\n- **\ud83d\uddc2\ufe0f Indexing** - Create and manage database indexes for performance\r\n- **\ud83d\udd17 Relationships** - Foreign key constraints and multi-table operations\r\n- **\ufffd\ufe0f Raw SQL** - Execute custom SQL when needed\r\n- **\ud83d\udcbe Serialization** - Convert results to JSON and dictionaries\r\n\r\n### Developer Experience\r\n- **\ud83d\udce6 Schema Management** - Declarative schema with automatic migrations via `akron.json`\r\n- **\u26a1 CLI Tools** - Modern command-line interface (`akron db init`, `migrate`, etc.)\r\n- **\ud83e\uddea Well Tested** - Comprehensive test coverage across all database drivers\r\n- **\ufffd Rich Documentation** - Complete guides and examples for all features\r\n\r\n---\r\n\r\n## \ud83d\ude80 Quick Start\r\n\r\n### Installation\r\n\r\n```bash\r\npip install akron\r\n```\r\n\r\n### Basic Usage\r\n\r\n```python\r\nfrom akron import Akron\r\n\r\n# Initialize database connection\r\ndb = Akron(\"sqlite:///example.db\")\r\n\r\n# Create table with relationships\r\ndb.create_table(\"users\", {\r\n    \"id\": \"int\",\r\n    \"name\": \"str\", \r\n    \"email\": \"str\",\r\n    \"age\": \"int\",\r\n    \"active\": \"bool\"\r\n})\r\n\r\ndb.create_table(\"posts\", {\r\n    \"id\": \"int\",\r\n    \"title\": \"str\",\r\n    \"content\": \"str\",\r\n    \"user_id\": \"int->users.id\",  # Foreign key to users table\r\n    \"published\": \"bool\"\r\n})\r\n\r\n# Insert data\r\nuser_id = db.insert(\"users\", {\r\n    \"name\": \"Alice Johnson\",\r\n    \"email\": \"alice@example.com\", \r\n    \"age\": 28,\r\n    \"active\": True\r\n})\r\n\r\n# Bulk insert\r\npost_ids = db.bulk_insert(\"posts\", [\r\n    {\"title\": \"Hello World\", \"content\": \"My first post\", \"user_id\": user_id, \"published\": True},\r\n    {\"title\": \"Python Tips\", \"content\": \"Some useful tips\", \"user_id\": user_id, \"published\": False}\r\n])\r\n\r\n# Advanced querying with QueryBuilder\r\npublished_posts = db.query(\"posts\").where(\r\n    published=True,\r\n    user_id=user_id\r\n).order_by(\"-created_at\").limit(10).all()\r\n\r\n# Find with operators\r\nyoung_users = db.query(\"users\").where(age__lt=30, active=True).all()\r\n\r\n# Aggregations\r\nuser_stats = db.aggregate(\"posts\", {\r\n    \"post_count\": \"count\",\r\n    \"avg_views\": \"avg\"\r\n}, group_by=[\"user_id\"])\r\n\r\n# Transactions\r\nwith db.transaction():\r\n    new_user_id = db.insert(\"users\", {\"name\": \"Bob\", \"email\": \"bob@example.com\", \"age\": 25, \"active\": True})\r\n    db.insert(\"posts\", {\"title\": \"Bob's First Post\", \"user_id\": new_user_id, \"published\": True})\r\n\r\n# Count and existence checks\r\ntotal_users = db.count(\"users\")\r\nhas_admin = db.exists(\"users\", {\"email\": \"admin@example.com\"})\r\n\r\n# Raw SQL for complex queries\r\nuser_post_stats = db.raw(\"\"\"\r\n    SELECT u.name, COUNT(p.id) as post_count\r\n    FROM users u LEFT JOIN posts p ON u.id = p.user_id\r\n    GROUP BY u.id, u.name\r\n    ORDER BY post_count DESC\r\n\"\"\")\r\n\r\n# Close connection\r\ndb.close()\r\n```\r\n\r\n### Type-Safe Models with Pydantic\r\n\r\n```python\r\nfrom pydantic import BaseModel\r\nfrom akron import Akron\r\nfrom akron.models import ModelMixin\r\n\r\nclass User(BaseModel, ModelMixin):\r\n    id: int\r\n    name: str\r\n    email: str\r\n    age: int\r\n    is_active: bool = True\r\n\r\n# Initialize database\r\ndb = Akron(\"sqlite:///users.db\")\r\n\r\n# Create table from model\r\nUser.create_table(db)\r\n\r\n# Insert with type safety\r\nnew_user = User(id=1, name=\"Bob Smith\", email=\"bob@example.com\", age=25)\r\nUser.insert(db, new_user)\r\n\r\n# Query with automatic deserialization\r\nusers = User.find(db)  # Returns List[User]\r\nactive_users = User.find(db, {\"is_active\": True})\r\n\r\n# Update and delete\r\nUser.update(db, {\"id\": 1}, {\"age\": 26})\r\nUser.delete(db, {\"email\": \"bob@example.com\"})\r\n```\r\n\r\n---\r\n\r\n## \ud83d\uddc4\ufe0f Database Support\r\n\r\n| Database    | Connection String Example | CRUD | Foreign Keys | Migrations | CLI Support |\r\n|-------------|---------------------------|------|--------------|------------|-------------|\r\n| **SQLite**  | `sqlite:///path/to/db.db` | \u2705   | \u2705           | \u2705         | \u2705          |\r\n| **MySQL**   | `mysql://user:pass@host:port/dbname` | \u2705   | \u2705           | \u2705         | \u2705          |\r\n| **PostgreSQL** | `postgres://user:pass@host:port/dbname` | \u2705   | \u2705           | \u2705         | \u2705          |\r\n| **MongoDB** | `mongodb://host:port/dbname` | \u2705   | \u274c*          | Schemaless | \u2705          |\r\n\r\n*MongoDB doesn't support traditional foreign keys but maintains the same API for document references.\r\n\r\n### Connection Examples\r\n\r\n```python\r\n# SQLite (file-based)\r\ndb = Akron(\"sqlite:///myapp.db\")\r\n\r\n# SQLite (in-memory)\r\ndb = Akron(\"sqlite:///:memory:\")\r\n\r\n# MySQL\r\ndb = Akron(\"mysql://username:password@localhost:3306/mydatabase\")\r\n\r\n# PostgreSQL\r\ndb = Akron(\"postgres://username:password@localhost:5432/mydatabase\")\r\n\r\n# MongoDB\r\ndb = Akron(\"mongodb://localhost:27017/mydatabase\")\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udd17 Advanced Features\r\n\r\n### Foreign Key Relationships\r\n\r\n```python\r\n# Create tables with foreign key relationships\r\ndb.create_table(\"users\", {\r\n    \"id\": \"int\",\r\n    \"name\": \"str\",\r\n    \"email\": \"str\"\r\n})\r\n\r\ndb.create_table(\"orders\", {\r\n    \"id\": \"int\",\r\n    \"user_id\": \"int->users.id\",  # Foreign key syntax\r\n    \"product_name\": \"str\",\r\n    \"amount\": \"float\",\r\n    \"status\": \"str\"\r\n})\r\n\r\n# Insert related data\r\nuser_id = db.insert(\"users\", {\"name\": \"Alice\", \"email\": \"alice@example.com\"})\r\norder_id = db.insert(\"orders\", {\r\n    \"user_id\": user_id,\r\n    \"product_name\": \"Laptop\",\r\n    \"amount\": 999.99,\r\n    \"status\": \"pending\"\r\n})\r\n\r\n# Query with relationships\r\nuser_orders = db.find(\"orders\", {\"user_id\": user_id})\r\n```\r\n\r\n### Complex Queries with QueryBuilder\r\n\r\n```python\r\n# Advanced filtering with operators\r\nresults = db.query(\"users\").where(\r\n    age__gte=25,           # age >= 25\r\n    name__like=\"John%\",    # name starts with \"John\" \r\n    active=True            # active = True\r\n).order_by(\"-created_at\").limit(10).all()\r\n\r\n# Pagination made simple\r\npage_1 = db.query(\"posts\").paginate(page=1, per_page=20)\r\npage_2 = db.query(\"posts\").paginate(page=2, per_page=20)\r\n\r\n# Joins and aggregations\r\nuser_stats = db.query(\"users\").join(\r\n    \"posts\", on=\"users.id = posts.user_id\"\r\n).select([\r\n    \"users.name\",\r\n    \"COUNT(posts.id) as post_count\"\r\n]).group_by(\"users.id\").all()\r\n\r\n# Bulk operations for performance\r\ndb.bulk_insert(\"products\", [\r\n    {\"name\": \"Product 1\", \"price\": 19.99},\r\n    {\"name\": \"Product 2\", \"price\": 29.99},\r\n    {\"name\": \"Product 3\", \"price\": 39.99}\r\n])\r\n\r\n# Atomic transactions\r\nwith db.transaction():\r\n    user_id = db.insert(\"users\", {\"name\": \"Charlie\", \"email\": \"charlie@example.com\"})\r\n    db.insert(\"profiles\", {\"user_id\": user_id, \"bio\": \"New user profile\"})\r\n    # All operations committed together or rolled back on error\r\n```\r\n\r\n### Performance and Indexing\r\n\r\n```python\r\n# Create indexes for faster queries\r\ndb.create_index(\"users\", [\"email\"])        # Single column index\r\ndb.create_index(\"orders\", [\"user_id\", \"status\"])  # Composite index\r\n\r\n# Performance optimization with exists()\r\nif db.exists(\"users\", {\"email\": \"admin@example.com\"}):\r\n    print(\"Admin user found\")\r\n\r\n# Count records efficiently\r\ntotal_active_users = db.count(\"users\", {\"active\": True})\r\n\r\n# Raw SQL for complex operations\r\nresults = db.raw(\"\"\"\r\n    SELECT category, AVG(price) as avg_price, COUNT(*) as item_count\r\n    FROM products \r\n    WHERE active = 1\r\n    GROUP BY category\r\n    HAVING COUNT(*) > 5\r\n    ORDER BY avg_price DESC\r\n\"\"\")\r\n```\r\n\r\n### Pydantic Model Relationships\r\n\r\n```python\r\nclass User(BaseModel, ModelMixin):\r\n    id: int\r\n    name: str\r\n    email: str\r\n    age: int\r\n\r\nclass Order(BaseModel, ModelMixin):\r\n    id: int\r\n    user_id: int  # Foreign key reference\r\n    product_name: str\r\n    amount: float\r\n    status: str\r\n\r\n# Create tables\r\nUser.create_table(db)\r\nOrder.create_table(db)\r\n\r\n# Work with related models\r\nuser = User(id=1, name=\"Charlie\", email=\"charlie@example.com\", age=30)\r\nUser.insert(db, user)\r\n\r\norder = Order(id=1, user_id=1, product_name=\"Book\", amount=24.99, status=\"shipped\")\r\nOrder.insert(db, order)\r\n\r\n# Query relationships\r\nuser_orders = Order.find(db, {\"user_id\": 1})\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udd04 Schema Management (Prisma-like)\r\n\r\nAkron now supports Prisma-like schema management with `akron.json` configuration files:\r\n\r\n### Initialize a New Project\r\n\r\n```bash\r\n# Initialize with SQLite (default)\r\nakron db init\r\n\r\n# Initialize with specific database\r\nakron db init --provider postgresql --url \"postgres://user:pass@localhost:5432/mydb\"\r\nakron db init --provider mysql --url \"mysql://user:pass@localhost:3306/mydb\"\r\nakron db init --provider mongodb --url \"mongodb://localhost:27017/mydb\"\r\n```\r\n\r\n### Define Your Schema\r\n\r\nEdit the generated `akron.json` file:\r\n\r\n```json\r\n{\r\n  \"database\": {\r\n    \"provider\": \"sqlite\",\r\n    \"url\": \"sqlite:///app.db\"\r\n  },\r\n  \"tables\": {\r\n    \"users\": {\r\n      \"columns\": {\r\n        \"id\": {\r\n          \"type\": \"int\",\r\n          \"primary_key\": true,\r\n          \"auto_increment\": true\r\n        },\r\n        \"email\": {\r\n          \"type\": \"str\",\r\n          \"unique\": true,\r\n          \"nullable\": false\r\n        },\r\n        \"username\": {\r\n          \"type\": \"str\",\r\n          \"unique\": true,\r\n          \"nullable\": false,\r\n          \"max_length\": 50\r\n        },\r\n        \"created_at\": {\r\n          \"type\": \"datetime\",\r\n          \"default\": \"CURRENT_TIMESTAMP\"\r\n        }\r\n      }\r\n    },\r\n    \"posts\": {\r\n      \"columns\": {\r\n        \"id\": {\r\n          \"type\": \"int\",\r\n          \"primary_key\": true,\r\n          \"auto_increment\": true\r\n        },\r\n        \"title\": {\r\n          \"type\": \"str\",\r\n          \"nullable\": false,\r\n          \"max_length\": 200\r\n        },\r\n        \"content\": {\r\n          \"type\": \"text\",\r\n          \"nullable\": true\r\n        },\r\n        \"author_id\": {\r\n          \"type\": \"int\",\r\n          \"nullable\": false\r\n        },\r\n        \"published\": {\r\n          \"type\": \"bool\",\r\n          \"default\": false\r\n        }\r\n      },\r\n      \"foreign_keys\": {\r\n        \"author_id\": {\r\n          \"references\": \"users\",\r\n          \"column\": \"id\",\r\n          \"on_delete\": \"CASCADE\"\r\n        }\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n### Generate and Apply Migrations\r\n\r\n```bash\r\n# Generate migrations from schema changes\r\nakron db makemigrations --name \"add_user_posts\"\r\n\r\n# Preview what will be migrated\r\nakron db migrate --dry-run\r\n\r\n# Apply migrations\r\nakron db migrate\r\n\r\n# Check migration status\r\nakron db status\r\n```\r\n\r\n### Schema Management Workflow\r\n\r\n1. **Initialize**: `akron db init` creates `akron.json` and `.akron/` directory\r\n2. **Define**: Edit `akron.json` to define your database schema\r\n3. **Generate**: `akron db makemigrations` creates migration files\r\n4. **Apply**: `akron db migrate` applies pending migrations\r\n5. **Monitor**: `akron db status` shows current state\r\n\r\n## \ud83d\udd04 Legacy Migration System\r\n\r\nFor backward compatibility, Akron still supports the original migration commands:\r\n\r\n### Auto-Generate Migrations\r\n\r\n```bash\r\n# Create a migration for schema changes\r\nakron makemigrations users --db sqlite:///app.db --schema '{\"id\": \"int\", \"name\": \"str\", \"email\": \"str\", \"created_at\": \"str\"}'\r\n\r\n# Apply migrations\r\nakron migrate users --db sqlite:///app.db\r\n\r\n# View migration history\r\nakron showmigrations users --db sqlite:///app.db\r\n```\r\n\r\n### Migration Features\r\n\r\n- **Automatic Schema Diffing** - Compares current vs target schema\r\n- **Migration File Generation** - Creates JSON migration files in `migrations/` directory\r\n- **Version Tracking** - Maintains migration history in `_akron_migrations` table\r\n- **Rollback Support** - Track applied migrations for potential rollbacks\r\n\r\n---\r\n\r\n## \ud83d\udee0\ufe0f CLI Commands\r\n\r\nAkron provides two command interfaces: **modern schema management** and **legacy commands**.\r\n\r\n### Modern Schema Management Commands\r\n\r\n```bash\r\n# Initialize a new Akron project\r\nakron db init                                      # SQLite default\r\nakron db init --provider postgresql --url \"...\"   # PostgreSQL\r\nakron db init --provider mysql --url \"...\"        # MySQL\r\nakron db init --provider mongodb --url \"...\"      # MongoDB\r\n\r\n# Generate migrations from schema changes\r\nakron db makemigrations                            # Auto-named migration\r\nakron db makemigrations --name \"add_user_table\"   # Custom name\r\n\r\n# Apply migrations\r\nakron db migrate                                   # Apply all pending\r\nakron db migrate --dry-run                        # Preview changes\r\n\r\n# Check status\r\nakron db status                                    # Show schema and migration status\r\n\r\n# Reset database (planned)\r\nakron db reset --force                            # Drop all and reapply\r\n```\r\n\r\n### Legacy Commands (Backward Compatibility)\r\n\r\n```bash\r\n# Table Management\r\nakron create-table users --db sqlite:///app.db --schema '{\"id\": \"int\", \"name\": \"str\"}'\r\nakron drop-table users --db sqlite:///app.db\r\nakron inspect-schema users --db sqlite:///app.db\r\n\r\n# Data Management\r\nakron seed users --db sqlite:///app.db --data '{\"name\": \"John\", \"email\": \"john@example.com\"}'\r\nakron raw-sql --db sqlite:///app.db --sql \"SELECT COUNT(*) FROM users\"\r\n\r\n# Legacy Migration Commands\r\nakron makemigrations orders --db mysql://user:pass@localhost/shop --schema '{\"id\": \"int\"}'\r\nakron migrate orders --db mysql://user:pass@localhost/shop\r\nakron showmigrations orders --db mysql://user:pass@localhost/shop\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udcca Type System\r\n\r\nAkron provides a flexible type system that maps Python types to database-specific types:\r\n\r\n### Supported Python Types\r\n\r\n| Python Type | SQL Databases | MongoDB |\r\n|-------------|---------------|---------|\r\n| `int`       | INTEGER       | Number  |\r\n| `str`       | VARCHAR/TEXT  | String  |\r\n| `float`     | REAL/DOUBLE   | Number  |\r\n| `bool`      | BOOLEAN       | Boolean |\r\n\r\n### Custom Type Mapping\r\n\r\n```python\r\n# Define custom field types in Pydantic models\r\nfrom pydantic import Field\r\nfrom datetime import datetime\r\n\r\nclass User(BaseModel, ModelMixin):\r\n    id: int\r\n    name: str\r\n    email: str = Field(..., max_length=255)\r\n    age: int = Field(..., ge=0, le=150)\r\n    created_at: str  # Store as ISO string\r\n    is_premium: bool = False\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udd27 Configuration & Best Practices\r\n\r\n### Connection Pooling\r\n\r\n```python\r\n# For production use, consider connection pooling\r\nclass DatabaseManager:\r\n    def __init__(self, db_url: str):\r\n        self.db_url = db_url\r\n        self._db = None\r\n    \r\n    def get_db(self):\r\n        if self._db is None:\r\n            self._db = Akron(self.db_url)\r\n        return self._db\r\n    \r\n    def close(self):\r\n        if self._db:\r\n            self._db.close()\r\n            self._db = None\r\n\r\n# Usage\r\ndb_manager = DatabaseManager(\"sqlite:///app.db\")\r\ndb = db_manager.get_db()\r\n```\r\n\r\n### Error Handling\r\n\r\n```python\r\nfrom akron.exceptions import AkronError, TableNotFoundError, SchemaError\r\n\r\ntry:\r\n    db = Akron(\"sqlite:///myapp.db\")\r\n    users = db.find(\"nonexistent_table\")\r\nexcept TableNotFoundError:\r\n    print(\"Table doesn't exist - creating it...\")\r\n    db.create_table(\"users\", {\"id\": \"int\", \"name\": \"str\"})\r\nexcept AkronError as e:\r\n    print(f\"Database error: {e}\")\r\n```\r\n\r\n### Environment-Based Configuration\r\n\r\n```python\r\nimport os\r\nfrom akron import Akron\r\n\r\n# Use environment variables for database configuration\r\nDATABASE_URL = os.getenv(\r\n    \"DATABASE_URL\", \r\n    \"sqlite:///default.db\"  # fallback for development\r\n)\r\n\r\ndb = Akron(DATABASE_URL)\r\n```\r\n\r\n---\r\n\r\n## \ud83e\uddea Testing\r\n\r\nAkron includes comprehensive test coverage and provides utilities for testing:\r\n\r\n### Test Database Setup\r\n\r\n```python\r\nimport pytest\r\nfrom akron import Akron\r\nfrom akron.models import ModelMixin\r\nfrom pydantic import BaseModel\r\n\r\nclass User(BaseModel, ModelMixin):\r\n    id: int\r\n    name: str\r\n    email: str\r\n\r\n@pytest.fixture\r\ndef test_db():\r\n    # Use in-memory database for testing\r\n    db = Akron(\"sqlite:///:memory:\")\r\n    User.create_table(db)\r\n    yield db\r\n    db.close()\r\n\r\ndef test_user_creation(test_db):\r\n    user = User(id=1, name=\"Test User\", email=\"test@example.com\")\r\n    User.insert(test_db, user)\r\n    \r\n    users = User.find(test_db, {\"email\": \"test@example.com\"})\r\n    assert len(users) == 1\r\n    assert users[0].name == \"Test User\"\r\n```\r\n\r\n### Running Tests\r\n\r\n```bash\r\n# Run the full test suite\r\npytest tests/\r\n\r\n# Run specific database tests\r\npytest tests/test_sqlite_pytest.py\r\npytest tests/test_mysql_pytest.py\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udcc8 Performance Considerations\r\n\r\n### Batch Operations\r\n\r\n```python\r\n# For large datasets, consider batch insertions\r\nusers_data = [\r\n    {\"name\": f\"User {i}\", \"email\": f\"user{i}@example.com\", \"age\": 20 + i}\r\n    for i in range(1000)\r\n]\r\n\r\nfor user_data in users_data:\r\n    db.insert(\"users\", user_data)\r\n```\r\n\r\n### Connection Management\r\n\r\n```python\r\n# Always close connections in production\r\ntry:\r\n    db = Akron(\"mysql://user:pass@localhost/prod_db\")\r\n    # ... database operations ...\r\nfinally:\r\n    db.close()\r\n\r\n# Or use context managers (if implementing __enter__/__exit__)\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udd0d Examples\r\n\r\nCheck out the `examples/` directory for more comprehensive examples:\r\n\r\n- `basic_crud.py` - Basic CRUD operations\r\n- `sqlite_multi_table.py` - Multi-table relationships with SQLite\r\n- `postgres_multi_table.py` - PostgreSQL with foreign keys\r\n\r\n---\r\n\r\n## \ud83c\udd9a Version Information\r\n\r\n- **Current Version**: v0.1.5\r\n- **Python Requirements**: Python 3.7+\r\n- **Dependencies**: \r\n  - `pydantic` - Type safety and validation\r\n  - `mysql-connector-python` - MySQL support\r\n  - `psycopg2` - PostgreSQL support  \r\n  - `pymongo` - MongoDB support\r\n\r\n### Changelog\r\n\r\nSee [CHANGELOG.md](CHANGELOG.md) for detailed version history and updates.\r\n\r\n---\r\n\r\n## \ud83d\udcda Quick Reference\r\n\r\n### Essential Operations Cheat Sheet\r\n\r\n```python\r\n# Basic CRUD\r\ndb.insert(\"table\", {\"field\": \"value\"})\r\ndb.find(\"table\", {\"field\": \"value\"})  \r\ndb.update(\"table\", {\"id\": 1}, {\"field\": \"new_value\"})\r\ndb.delete(\"table\", {\"field\": \"value\"})\r\n\r\n# Advanced Querying  \r\ndb.query(\"table\").where(age__gte=25, active=True).order_by(\"-created_at\").limit(10).all()\r\ndb.query(\"table\").paginate(page=1, per_page=20)\r\n\r\n# Aggregations\r\ndb.count(\"table\", {\"active\": True})\r\ndb.aggregate(\"table\", {\"total\": \"sum\", \"avg_price\": \"avg\"})\r\n\r\n# Bulk Operations\r\ndb.bulk_insert(\"table\", [{\"name\": \"A\"}, {\"name\": \"B\"}])\r\ndb.bulk_update(\"table\", {\"active\": False}, {\"status\": \"inactive\"})\r\n\r\n# Transactions\r\nwith db.transaction():\r\n    # Multiple operations here\r\n\r\n# Performance\r\ndb.exists(\"table\", {\"email\": \"user@example.com\"})\r\ndb.create_index(\"table\", [\"email\", \"status\"])\r\ndb.raw(\"SELECT * FROM table WHERE custom_condition\")\r\n```\r\n\r\n### QueryBuilder Operators\r\n\r\n| Operator | Example | SQL Equivalent |\r\n|----------|---------|----------------|\r\n| `field` | `where(age=25)` | `WHERE age = 25` |\r\n| `field__gt` | `where(age__gt=18)` | `WHERE age > 18` |\r\n| `field__gte` | `where(age__gte=18)` | `WHERE age >= 18` |\r\n| `field__lt` | `where(age__lt=65)` | `WHERE age < 65` |\r\n| `field__lte` | `where(age__lte=65)` | `WHERE age <= 65` |\r\n| `field__in` | `where(status__in=[\"active\", \"pending\"])` | `WHERE status IN (...)` |\r\n| `field__like` | `where(name__like=\"John%\")` | `WHERE name LIKE 'John%'` |\r\n| `field__isnull` | `where(deleted_at__isnull=True)` | `WHERE deleted_at IS NULL` |\r\n\r\n---\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nWe welcome contributions! Please feel free to:\r\n\r\n1. **Report Issues** - Found a bug? Let us know!\r\n2. **Feature Requests** - Have an idea? We'd love to hear it!\r\n3. **Pull Requests** - Code contributions are always welcome!\r\n\r\n### Development Setup\r\n\r\n```bash\r\n# Clone the repository\r\ngit clone https://github.com/Akash-nath29/akron.git\r\ncd akron\r\n\r\n# Install development dependencies\r\npip install -e .\r\npip install pytest\r\n\r\n# Run tests\r\npytest tests/\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udcc4 License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n---\r\n\r\n## \ud83d\udd17 Links\r\n\r\n- **PyPI Package**: https://pypi.org/project/akron/\r\n- **GitHub Repository**: https://github.com/Akash-nath29/akron\r\n- **Documentation**: https://akron-website.vercel.app/docs\r\n- **Issues & Support**: https://github.com/Akash-nath29/akron/issues\r\n\r\n---\r\n\r\n<div align=\"center\">\r\n\r\n**Made with \u2764\ufe0f by the Akron team**\r\n\r\n\u2b50 **Star us on GitHub if you find Akron useful!** \u2b50\r\n\r\n</div>\r\n\r\n---\r\n\r\n## \ud83d\udd04 Transactions & Atomic Operations\r\n\r\n**Transactions** let you group multiple database operations into a single, all-or-nothing unit. This means either *all* changes succeed together, or *none* are applied if something fails. This is essential for keeping your data safe and consistent.\r\n\r\n### Why Use Transactions?\r\n- **Data Integrity:** Prevents partial updates and keeps your database consistent.\r\n- **Automatic Rollback:** If any operation fails, all changes are undone automatically.\r\n- **Business Logic:** Ensures complex operations (like money transfers, order processing) are atomic.\r\n\r\n### Example Usage\r\n```python\r\nwith db.transaction():\r\n    user_id = db.insert(\"users\", {\"name\": \"Alice\"})\r\n    db.insert(\"profiles\", {\"user_id\": user_id})\r\n    # If any step fails, all changes are rolled back!\r\n```\r\n\r\n### Real-World Scenarios\r\n- **Money Transfer:** Deduct from one account, add to another, log the transaction. If any step fails, no money is lost.\r\n- **Order Processing:** Charge customer, reduce inventory, create order record. If payment fails, inventory isn&apos;t reduced.\r\n- **User Registration:** Create account, profile, send email. If any step fails, no partial user is created.\r\n\r\n### How It Works\r\n1. Akron starts a transaction when you enter the `with db.transaction()` block.\r\n2. If all operations succeed, changes are committed.\r\n3. If any operation fails, Akron automatically rolls back all changes.\r\n\r\n### Best Practices\r\n- Use transactions for any set of operations that must succeed together.\r\n- Don&apos;t use transactions for simple, single-step reads or writes.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Universal, framework-independent ORM for Python.",
    "version": "0.2.3",
    "project_urls": {
        "Homepage": "https://github.com/Akash-nath29/akron"
    },
    "split_keywords": [
        "orm",
        "database",
        "sql",
        "nosql",
        "sqlite",
        "mysql",
        "postgres",
        "mongodb"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3500a5d415141a758541e74f7e75303838f82eef7b7ddd89fd2cf3f2a87a0cae",
                "md5": "2c20cde6f8a99b4ff8278cd7d4f684a3",
                "sha256": "c26244b01eff13d29099a73c63cbe8dcf47df00bcaf653b8b29c321a874fda79"
            },
            "downloads": -1,
            "filename": "akron-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2c20cde6f8a99b4ff8278cd7d4f684a3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 33064,
            "upload_time": "2025-09-12T07:36:56",
            "upload_time_iso_8601": "2025-09-12T07:36:56.181289Z",
            "url": "https://files.pythonhosted.org/packages/35/00/a5d415141a758541e74f7e75303838f82eef7b7ddd89fd2cf3f2a87a0cae/akron-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a0dd96ec25c660f42a736137e0553177afe1b26ba58708c45f87ce28a09ab56b",
                "md5": "61d8f7eef35da1f27551e9e133e488fd",
                "sha256": "bcb377409e1390f7fc8305d61aa17171dc024b5a86f9786c1537247b99af4c49"
            },
            "downloads": -1,
            "filename": "akron-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "61d8f7eef35da1f27551e9e133e488fd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 36934,
            "upload_time": "2025-09-12T07:36:58",
            "upload_time_iso_8601": "2025-09-12T07:36:58.941765Z",
            "url": "https://files.pythonhosted.org/packages/a0/dd/96ec25c660f42a736137e0553177afe1b26ba58708c45f87ce28a09ab56b/akron-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-12 07:36:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Akash-nath29",
    "github_project": "akron",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "akron"
}
        
Elapsed time: 2.90568s