🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

oxyde

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oxyde

High-performance async Python ORM with Rust core

pipPyPI
Version
0.1.0
Maintainers
1

Oxyde ORM

High-performance async Python ORM with Rust core.

Oxyde combines Python's expressiveness with Rust's performance. Models defined with Pydantic v2, queries executed in native Rust.

from oxyde import OxydeModel, Field, db

class User(OxydeModel):
    class Meta:
        is_table = True

    id: int | None = Field(default=None, db_pk=True)
    email: str = Field(db_unique=True)
    age: int = Field(ge=0, le=150)

async def main():
    async with db.connect("postgresql://localhost/mydb"):
        # Create
        user = await User.objects.create(email="alice@example.com", age=30)

        # Read
        users = await User.objects.filter(age__gte=18).limit(10).all()

        # Update
        await User.objects.filter(id=user.id).update(age=31)

        # Delete
        await User.objects.filter(id=user.id).delete()

Features

  • Django-style API — Familiar Model.objects.filter() syntax
  • Pydantic v2 models — Full validation, type hints, serialization
  • Async-first — Built for modern async Python with asyncio
  • Rust performance — SQL generation and execution in native Rust
  • Multi-database — PostgreSQL, SQLite, MySQL support
  • Transactions — atomic() context manager with savepoints
  • Migrations — Django-style makemigrations and migrate CLI

Installation

pip install oxyde

Quick Start

Define a Model

from oxyde import OxydeModel, Field

class User(OxydeModel):
    class Meta:
        is_table = True

    id: int | None = Field(default=None, db_pk=True)
    name: str
    email: str = Field(db_unique=True)
    age: int | None = Field(default=None)

Connect and Query

from oxyde import db

async with db.connect("sqlite:///app.db"):
    # Create
    user = await User.objects.create(name="Alice", email="alice@example.com", age=30)

    # Query
    adults = await User.objects.filter(age__gte=18).all()

    # Get single object
    user = await User.objects.get(id=1)

    # Update
    user.age = 31
    await user.save()

    # Delete
    await user.delete()

Transactions

from oxyde.db import transaction

async with transaction.atomic():
    user = await User.objects.create(name="Alice", email="alice@example.com")
    await Profile.objects.create(user_id=user.id)
    # Auto-commits on success, rolls back on exception

FastAPI Integration

from fastapi import FastAPI
from oxyde import db

app = FastAPI(
    lifespan=db.lifespan(
        default="postgresql://localhost/mydb",
    )
)

@app.get("/users")
async def get_users():
    return await User.objects.filter(is_active=True).all()

Database Support

DatabaseMin VersionStatusNotes
PostgreSQL12+FullRETURNING, UPSERT, FOR UPDATE/SHARE, JSON, Arrays
SQLite3.35+FullRETURNING, UPSERT, WAL mode by default
MySQL8.0+FullUPSERT via ON DUPLICATE KEY, FOR UPDATE/SHARE

Recommendation: PostgreSQL for production, SQLite for development/testing.

SQLite < 3.35: Falls back to last_insert_rowid() which may return incorrect IDs with concurrent inserts.

MySQL: No RETURNING clause — uses last_insert_id(). Bulk INSERT returns calculated ID range which may be incorrect with concurrent inserts.

Connection URLs:

"postgresql://user:password@localhost:5432/database"
"sqlite:///path/to/database.db"
"sqlite:///:memory:"
"mysql://user:password@localhost:3306/database"

Documentation

Full documentation: https://oxyde.fatalyst.dev/

  • Getting Started — First steps with Oxyde
  • User Guide — Models, queries, relations, transactions
  • Cheatsheet — Quick reference for all methods
  • FAQ — Common questions and answers

Contributing

If you have suggestions or find a bug, please open an issue or create a pull request on GitHub.

License

This project is licensed under the terms of the MIT license.

Keywords

orm

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts