Skip to main content

A fast DynamoDB ORM for Python with a Rust core

Project description

pydynox 🐍⚙️

CI PyPI version Python versions License Downloads

A fast DynamoDB ORM for Python with a Rust core.

Pre-release: The core features are working and tested. We're adding features, polishing the API, receiving ideas, and testing performance and edge cases before v1.0. Feel free to try it out and share feedback!

Why "pydynox"?

Py(thon) + Dyn(amoDB) + Ox(ide/Rust)

GenAI Contributions 🤖

I believe GenAI is transforming how we build software. It's a powerful tool that accelerates development when used by developers who understand what they're doing.

To support both humans and AI agents, I created:

  • .ai/ folder - Guidelines for agentic IDEs (Cursor, Windsurf, Kiro, etc.)
  • ADR/ folder - Architecture Decision Records for humans to understand the "why" behind decisions

If you're contributing with AI help:

  • Understand what the AI generated before submitting
  • Make sure the code follows the project patterns
  • Test your changes

I reserve the right to reject low-quality PRs where project patterns are not followed and it's clear that GenAI was driving instead of the developer.

Features

  • Simple class-based API like PynamoDB
  • Fast serialization with Rust
  • Batch operations with auto-splitting
  • Transactions
  • Global Secondary Indexes
  • Async support
  • Pydantic integration

Installation

pip install pydynox

For Pydantic support:

pip install pydynox[pydantic]

Quick Start

Define a Model

from pydynox import Model, ModelConfig, String, Number, Boolean, List

class User(Model):
    model_config = ModelConfig(table="users")
    
    pk = String(hash_key=True)
    sk = String(range_key=True)
    name = String()
    email = String()
    age = Number(default=0)
    active = Boolean(default=True)
    tags = List(String)

CRUD Operations

# Create
user = User(pk="USER#123", sk="PROFILE", name="John", email="john@test.com")
user.save()

# Read
user = User.get(pk="USER#123", sk="PROFILE")

# Update
user.name = "John Doe"
user.save()

# Delete
user.delete()

Query

from pydynox import Condition

# Simple query
users = User.query(pk="USER#123")

# With filters
users = User.query(pk="USER#123") \
    .where(Condition.begins_with("sk", "ORDER#")) \
    .where(Condition.gt("age", 18)) \
    .exec()

# Iterate (auto pagination)
for user in users:
    print(user.name)

Conditions

from pydynox import Condition

# Save with condition
user.save(condition=Condition.not_exists("pk"))

# Delete with condition
user.delete(condition=Condition.eq("version", 5))

# Combine conditions
user.save(
    condition=Condition.not_exists("pk") | Condition.eq("version", 1)
)

Available conditions:

  • Condition.eq(field, value) - equals
  • Condition.ne(field, value) - not equals
  • Condition.gt(field, value) - greater than
  • Condition.gte(field, value) - greater than or equal
  • Condition.lt(field, value) - less than
  • Condition.lte(field, value) - less than or equal
  • Condition.exists(field) - attribute exists
  • Condition.not_exists(field) - attribute does not exist
  • Condition.begins_with(field, prefix) - string starts with
  • Condition.contains(field, value) - string or list contains
  • Condition.between(field, low, high) - value in range

Atomic Updates

from pydynox import Action

# Simple set
user.update(name="New Name", email="new@test.com")

# Increment a number
user.update(Action.increment("age", 1))

# Append to list
user.update(Action.append("tags", ["verified"]))

# Remove field
user.update(Action.remove("temp_field"))

# Combine with condition
user.update(
    Action.increment("age", 1),
    condition=Condition.eq("status", "active")
)

Batch Operations

# Batch write
with User.batch_write() as batch:
    batch.save(user1)
    batch.save(user2)
    batch.delete(user3)

# Batch get
users = User.batch_get([
    ("USER#1", "PROFILE"),
    ("USER#2", "PROFILE"),
])

Global Secondary Index

from pydynox import GlobalIndex, ModelConfig

class User(Model):
    model_config = ModelConfig(table="users")
    
    pk = String(hash_key=True)
    sk = String(range_key=True)
    email = String()
    
    email_index = GlobalIndex(hash_key="email")

# Query on index
users = User.email_index.query(email="john@test.com")

Transactions

with User.transaction() as tx:
    tx.save(user1)
    tx.delete(user2)
    tx.update(user3, Action.increment("age", 1))

Async Support

# All methods work with await
user = await User.get(pk="USER#123", sk="PROFILE")
await user.save()

async for user in User.query(pk="USER#123"):
    print(user.name)

Pydantic Integration

from pydynox import dynamodb_model
from pydantic import BaseModel, EmailStr

@dynamodb_model(table="users", hash_key="pk", range_key="sk")
class User(BaseModel):
    pk: str
    sk: str
    name: str
    email: EmailStr
    age: int = 0

# All pydynox methods available
user = User(pk="USER#123", sk="PROFILE", name="John", email="john@test.com")
user.save()

Table Management

# Create table
User.create_table()

# Create with custom capacity
User.create_table(read_capacity=10, write_capacity=5)

# Create with on-demand billing
User.create_table(billing_mode="PAY_PER_REQUEST")

# Check if table exists
if not User.table_exists():
    User.create_table()

# Delete table
User.delete_table()

Documentation

Full documentation: https://leandrodamascena.github.io/pydynox

License

MIT License

Inspirations

This project was inspired by:

  • PynamoDB - The ORM-style API and model design
  • Pydantic - Data validation patterns and integration approach
  • dynarust - Rust DynamoDB client patterns
  • dyntastic - Pydantic + DynamoDB integration ideas

Building from Source

Requirements

  • Python 3.11+
  • Rust 1.70+
  • maturin

Setup

# Clone the repo
git clone https://github.com/leandrodamascena/pydynox.git
cd pydynox

# Install maturin
pip install maturin

# Build and install locally
maturin develop

# Or with uv
uv run maturin develop

Running Tests

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydynox-0.11.0.tar.gz (273.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pydynox-0.11.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

pydynox-0.11.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64

pydynox-0.11.0-cp314-cp314-macosx_11_0_arm64.whl (5.9 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pydynox-0.11.0-cp314-cp314-macosx_10_12_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

pydynox-0.11.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pydynox-0.11.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

pydynox-0.11.0-cp313-cp313-macosx_11_0_arm64.whl (5.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pydynox-0.11.0-cp313-cp313-macosx_10_12_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

pydynox-0.11.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pydynox-0.11.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

pydynox-0.11.0-cp312-cp312-macosx_11_0_arm64.whl (5.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pydynox-0.11.0-cp312-cp312-macosx_10_12_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

pydynox-0.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pydynox-0.11.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

pydynox-0.11.0-cp311-cp311-macosx_11_0_arm64.whl (5.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pydynox-0.11.0-cp311-cp311-macosx_10_12_x86_64.whl (6.3 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file pydynox-0.11.0.tar.gz.

File metadata

  • Download URL: pydynox-0.11.0.tar.gz
  • Upload date:
  • Size: 273.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pydynox-0.11.0.tar.gz
Algorithm Hash digest
SHA256 aa54a29344500707cf1913eef79e0eb1b40afc9322e8294cfd0dc64f060415c9
MD5 ee27197787ee293ff13638d07820d037
BLAKE2b-256 109ef1b1dcabc5070f2f0979b43859644f1f36f104047cd3d20dbb4999e1eee7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0.tar.gz:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3039f6efd817a0cfcaca493309d91049e628d59cd7e7df04003a5305b8dafafb
MD5 2c8205eb2c32d57be89d318ab58842f3
BLAKE2b-256 8608d821e1276868b0c52bad3a549041ea3809b5dd42a5d348393b3dec7d8030

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f5116d47aff15844fef5b4b95e78281a5959cf2cbf12a1f8062fbecf03b3fba3
MD5 8db9e3bab0d08ff06c2998ab21c8412b
BLAKE2b-256 767a55b3b87eb883157e09f4981fb1bdf835000d2ec3bed1afc6b3d41f51b4cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3ecb5abe8123688d1706004f866e6dc3044e130979839c424ab87dde89b5513c
MD5 45a0b2cc7b672eafaa8518afe491637a
BLAKE2b-256 0238738c9b0a7544add43cc3e230a92bf65765e101f2d90a3ffce7797d1dda11

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp314-cp314-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 72562dc43e3c45fefacfb002db9be6e6f062b999355a318b9a10096de3acbe48
MD5 06349384d5cd99fae91f05589ecdc712
BLAKE2b-256 d91971cdaa00e5c9c0c6d188f645e886f47b99ca10f1daff7d6ee92472ae78fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp314-cp314-macosx_10_12_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9a04364b52f8b5bc2e0f7533f3c1f453dbc542dfc2b0ac51ed7bd6a7f59dcc27
MD5 ff66f083c3b7f9589146796b47dd53fe
BLAKE2b-256 c7fbf8868517c636881a652a6e1c2fd90ab4584e1e60f499dbf8a0beb0f6895a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3896676d28249536c44b1a9ddeb129e1b2736b8a9187e655c147bb462cf102b6
MD5 4da4e101e7ffadf7911e10132ca746f6
BLAKE2b-256 37541ce651135701bb3190ee35f783c086f8fb0f73b3aced3366e9791b93ce96

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a9970f15076e0cd4a868da2800af055a4432a8ae779ba6e9f024b6de2b978831
MD5 d8e86baafeffcfa860b1880a7247c66a
BLAKE2b-256 41a1d069dd4ea379a263307ae24a7938d9cdb2d07ca19eef232c1c389f4f429f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 31e66cc325ed40246ed26ec5aeaf028c53ffd9f86ce5981e76592e2e383acee5
MD5 4bde73e386c4b88027ed414c8f05491d
BLAKE2b-256 3089ca66a2fdd116d41a26ae1e5438893a8cb88167602b2f704642e13985fea1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ae058ba5f574cec3b293b01ac291aecee7ccb2aecef5701d093b3c32d765262d
MD5 f6497b804c05da1a6a443c7f9e02af3d
BLAKE2b-256 1fa910c4327d1abbbf4a999b798f22915ef94ae618e87ce182e0bd1f26f00547

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 86884352248b2cdfede1d41443c1aa989c868efbbc47ada8534217af4f246b58
MD5 9595b6f0936165aeb07475ea5413f0fa
BLAKE2b-256 88044394929fa0d50d4af8ee9fbb9b86b8f319bc0cda205ae91379b93f4d5ca0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a7e242f106147cefa341bd99c0696a025984c1cfe6344e40ce27a267c6fa8cb3
MD5 7e39e30dd8d30dbe46b2cc75833a38a9
BLAKE2b-256 dbf8bf93f2e90df0634ad2aa401188b944bd88e89440116241edae59edbc7dae

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0777f38133f025615319e6f066cede25aa9c1f3eaa36dcaad26e15e5513a13f4
MD5 983c074bb3f9915327999878bfbda058
BLAKE2b-256 b9dcba1bd9f7b36a8face0d37eeaaa5d5b7074530c6131eeb9055898d8fb45a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5aa63164ce1d3c5ba467f75247afaaa4b294e5ec8b051550ebcb71f5346056da
MD5 e1a565b475a8e06bf101424d73286d4d
BLAKE2b-256 8d6d25f75d3e30938d74c93b0be20e16dee1d659602a63444766c213667be95b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5d34b196eca6474490a484229f2b52f05120f255778ca4ed3c2e5b1dd6d1d322
MD5 b95d9fca473fe1a9cb7900c39fc4e40d
BLAKE2b-256 5fb1b26ee9266fe8da901bed38e7367457b05e6f87da0113e2a94e8d99bb641b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a31de975e547a70ca3e5828c8a7201d36bc277137ec133b530557ba0752da11b
MD5 610548d64dbe4bd9a082f8ddeb7b0cd8
BLAKE2b-256 6e5ee674763d16b030dc9f1a5fd23eba6cf43b72fd6c1e7b885441f26f4913fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydynox-0.11.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.11.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0099692774b4ee648f395762b052818a7fb5a40f74e0d9bb65ca876f1d79850a
MD5 19b287f2944170cff1905ec6a2b0ffba
BLAKE2b-256 f5c1d713fcbd7707c91c8ee59aada772939a903c3da97b76d369324e5a6597c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.11.0-cp311-cp311-macosx_10_12_x86_64.whl:

Publisher: release.yml on leandrodamascena/pydynox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page