Skip to main content

Oxyde for PostgreSQL

Oxyde for PostgreSQL is a PostgreSQL-focused fork of Oxyde ORM: a type-safe, Pydantic-centric asynchronous ORM with a high-performance Rust core designed for clarity, speed, and reliability. It builds on Oxyde's great work and optimizes it for PostgreSQL with bug fixes and PostgreSQL-specific features.

Requires PostgreSQL 18+ and Python 3.13+. The Rust core checks the server version when connecting. Both postgres:// and postgresql:// connection URLs are supported.

Features

  • Pydantic v2 models with validation, type hints, and serialization.
  • Familiar Model.objects.filter() queries, joins, aggregates, and bulk operations.
  • Native PostgreSQL arrays, JSONB, enums, UUIDs, decimals, RETURNING, and row locks.
  • Array and JSON lookups: contains, contained_by, and overlap.
  • Async transactions with nested savepoints and public transaction-depth reporting.
  • Schema migrations with PostgreSQL advisory locking and transactional DDL.
  • Rust SQL generation, connection pooling, and execution, with Python 3.15 wheel support.
  • Cache-disabled unnamed statements for PostgreSQL/PgBouncer, including cold custom-type decoding without replaying queries.

Version 0.3.2 adds expression and operator-class indexes (Index((Lower("email"),), name=...), Index(..., opclasses=(...))) and the Lower / Upper expressions. Version 0.3.1 added scalar expressions (Coalesce, Greatest, Concat, Value, RawSQL, and F arithmetic) to annotations and updates, with typed NULL, enum, and array handling. The expression guide covers usage, and the release notes describe compatibility changes.

The fork also includes typed array and JSON containment, NULLS NOT DISTINCT constraints, Rust migration replay, transaction depth, and complete generated type stubs. The connection guide explains the patched driver's statement-cache and PgBouncer behavior.

Installation

pip install oxyde-postgres

The distribution names are oxyde-postgres and oxyde-postgres-core. Python imports remain oxyde, the native module remains _oxyde_core, and the CLI remains oxyde. Use a separate virtual environment from upstream Oxyde because the packages share these import names.

To build this checkout:

uv venv --python 3.13
source .venv/bin/activate
uv pip install maturin
maturin develop --manifest-path crates/oxyde-core-py/Cargo.toml
uv pip install -e './python[dev]'

Quick start

import asyncio
from oxyde import Field, Model, db
from oxyde.db.schema import create_tables


class User(Model):
    id: int | None = Field(default=None, db_pk=True)
    name: str
    email: str = Field(db_unique=True)
    tags: list[str] = Field(default_factory=list)

    class Meta:
        is_table = True


async def main():
    await db.init(default="postgresql://user:password@localhost:5432/app")
    try:
        connection = await db.get_connection()
        await create_tables(connection)
        await User.objects.create(
            name="Alice", email="alice@example.com", tags=["python"]
        )
        users = await User.objects.filter(tags__contains=["python"]).all()
        print(users)
    finally:
        await db.close()


asyncio.run(main())

For managed schema changes, run oxyde init, oxyde makemigrations, and oxyde migrate. See the documentation, connection guide, and contributor guide.

Credit and license

Oxyde for PostgreSQL is based on Oxyde, created by Nikita Ryzhenkov and its contributors. The original MIT license is preserved. The vendored SQLx PostgreSQL driver retains its MIT and Apache-2.0 licenses.

Metadata

Release files for oxyde-postgres 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oxyde-postgres 0.3.2
File Size Uploaded Provenance Actions
oxyde_postgres-0.3.2.tar.gz 132.5 kB Without provenance Details for oxyde_postgres-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for oxyde-postgres 0.3.2
File Interpreter ABI Platform Actions
oxyde_postgres-0.3.2-py3-none-any.whl Python 3 none any Details for oxyde_postgres-0.3.2-py3-none-any.whl

Total release size: 290.3 kB

Release files / oxyde_postgres-0.3.2.tar.gz

Download URL oxyde_postgres-0.3.2.tar.gz
Size 132.5 kB
Tags Source
SHA-256 checksum
How to use checksums
60410fc946b0c3b5e1a19f96b8558a7649d6a406089a5e1746e0b4c71d385251
BLAKE2b-256 checksum
How to use checksums
d542858f94704ed36765f5f99b6c1e03d3273c643daa8da0b2fe88f79254ece2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / oxyde_postgres-0.3.2-py3-none-any.whl

Download URL oxyde_postgres-0.3.2-py3-none-any.whl
Size 157.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ca9408fd5a9a9f55771397df0163c30ec519a10f06195d8685b907e143f8da4
BLAKE2b-256 checksum
How to use checksums
7990d1a0b426e9d186eaf08364590c9b4d8f1bc4b16270927a1655c4d126a377
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for oxyde-postgres 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page