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.

⚠️ Early Development: This project is not ready for production yet. The API may change before v1.0.

We welcome feedback and contributions! Check the open issues to see what's planned or to share your ideas.

Why "pydynox"?

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

GenAI Contributions 🤖

This project welcomes GenAI-assisted contributions! Parts of the code and docstrings were written with AI help.

If you're using AI tools to contribute, check the .ai/ folder. It has all the guidelines:

  • .ai/README.md - Quick start for AI agents
  • .ai/project-context.md - What is pydynox, tech stack
  • .ai/coding-guidelines.md - Code style, Python vs Rust decisions
  • .ai/testing-guidelines.md - How to write tests
  • .ai/common-mistakes.md - Things that break the build

Rules for AI-assisted contributions:

  • Follow the project's coding style and patterns
  • Make sure the code makes sense and is tested
  • Don't submit random or low-quality generated code
  • Review and understand what the AI generated before submitting

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.9.0.tar.gz (236.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.9.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.4 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

pydynox-0.9.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64

pydynox-0.9.0-cp314-cp314-macosx_11_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pydynox-0.9.0-cp314-cp314-macosx_10_12_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

pydynox-0.9.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pydynox-0.9.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

pydynox-0.9.0-cp313-cp313-macosx_11_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pydynox-0.9.0-cp313-cp313-macosx_10_12_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

pydynox-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pydynox-0.9.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.9.0-cp312-cp312-macosx_11_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pydynox-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

pydynox-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pydynox-0.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

pydynox-0.9.0-cp311-cp311-macosx_11_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pydynox-0.9.0-cp311-cp311-macosx_10_12_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: pydynox-0.9.0.tar.gz
  • Upload date:
  • Size: 236.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.9.0.tar.gz
Algorithm Hash digest
SHA256 8f1a15f1ff6a2eb19a2eb8d606cb21911870015697b4c1fec1ebc44eed9abd08
MD5 a8c62499297898149e5ddc7ff6497298
BLAKE2b-256 4f6180719cfa4c5476ff70d55ecfea6d2b12fddc8cb68b12aec2708684d75452

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1d0c8095053fe02714fe636e3220892da94b833433c7d23f2a14b74571565f62
MD5 904f858358f88e5ef0827546b475229e
BLAKE2b-256 00266fcfb762c1832507bdd65094e547491cad716777b480f1ae9feca93c25d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7cc39e64028ea49bc721eae9277f18efbb027cbbf42c1bd212f34c606c93479b
MD5 3eda726fb3bcccdbe77e994ac3b177b2
BLAKE2b-256 8e83da962f71a6371418ca071651cd19beb1c77fb730f3fcf5f8e55234cceb4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b53923214b6129bc7ce67bb027b1c1529a85d496331c2c423dfa55163b6a2a47
MD5 81d83e74f37c0481171c320a44610013
BLAKE2b-256 c133d5ffccbd2200d6b884e366b5600bf51e3edc30148420c702587e3d127b42

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp314-cp314-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f20e6e9b8260e34cf805464eef25463fb8bd6de7341ba3ace67467961d12bd58
MD5 b9242d3d79240abe8df9771b652bf195
BLAKE2b-256 58581e8cc248b66d0d3c6465628fe8454af1c2b468e47902f789dbfca584a51f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ddbd62cfa5db075565e7926412289461a932303c9397f460fde27204181397b2
MD5 4ae06cea0d3b276d1caf5a153f3e20d5
BLAKE2b-256 2fc3e3123cbab87e9e5793460999b8f013d4c8817b6f6dfe35e21da187df9746

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 417492ca01b5a191a04c916fc3d404f02f41240c67b42da5b351ac6e911d1e70
MD5 a5b79106c463d89ec3fa3bc2332a1e40
BLAKE2b-256 fa8861093bc288838ecd861add6c9f5401dc2044d2e1d246f2a09bfd21c2c564

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 623757f548025751db41e22523b44c259ec54bee60ea0627263477e604c16920
MD5 bcd099a38761fda7626adfb1688189f7
BLAKE2b-256 d6208f7472f98051e09f548d3ee4aaaae6a5f1d10271c50f1c8143bdb2cc104e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4c48f857c1efb6f14dfd8a4cf221d2cd8486a20126eff292c7b5893b4eb3f97b
MD5 35efcd48c05479578b0bdf49522cf441
BLAKE2b-256 d82799aef58cf72d30f790a1f26420cd1a80c1174e0692140874e17df445fa6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e45dbe6cc34c35a9c90c2c2207b1b1f418183bb96dbca4a1c0fbe3519e1c682c
MD5 2d781c3cdd5dd5ed097852cbd20bfc01
BLAKE2b-256 1d4f503762e95b6738dc997111159ee67ec515547032e94460141efb4028900c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 251e96291cb3164133d7783d766f6adf9159906cf4b10d082dbc380276d66075
MD5 133a4aa4afa5063ecb02e4bdb13ba1a2
BLAKE2b-256 d5bebecbdc1dd104fa9cb9aadb6fcba75fb611c2ed4081bc5180116a4ac847cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d58932821a6e7188ebc7d81b345b87e3190822e9ccc4d2f33a9ce6016e4ccbe0
MD5 09e388bf2c30fcecbcf567969341aff0
BLAKE2b-256 12939c389d39ba9af81d62df41af9aedb136820a5805f2e7838b3ef416b8b822

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 40ebd309315b3b0149b855685a2dd49a15bce18a8ba6070a3055e3d1a5a7580e
MD5 db9c6b22b95436daa5456a474e884cfe
BLAKE2b-256 3701edb37ae6ae66cb015c9eaabb5a2076d74e83145cacd57a29d71cd785e8d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3c6442c54bdde2b5ce0901e7d2726c48710789931a8fbac2ca94907f8bd2a330
MD5 df1fa283a7a6dd17d69ce411eaa09f22
BLAKE2b-256 8b0e68d61954fbb556d42d99bb167345b8bf192abcb6d54281c0a90f4127ef02

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c54cfdc093305eff7dbe3e77a4144ea26942994945e4c6aeced425938e1bbd53
MD5 315fb30b68018a7c4a68642573c1f791
BLAKE2b-256 4869c5a410234d4c5b4fa1e359ea3bb22e620ea506154114c3e47988ed250c59

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a5cdde70bc511d8f6e8ba6d56596cf19cc1f2d341ad7070e5f0e9df8396f8e9
MD5 7685e9372d98a0d98dd706fd1191e312
BLAKE2b-256 8455edd46ce3969fb234aa3d55e8e521bc62a26f22a257e99c6bfd8a3dbed6f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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.9.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pydynox-0.9.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6292eab09d240de69615d71693718d8e0474f4a7b41f7188b59b4ae1b893c512
MD5 2bd5e2393c964c4f1ae9fbda36a0a1ac
BLAKE2b-256 d2ca42c8eb2213000884c347718aba4bfd21feb179eda98bcd13579eec8af924

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydynox-0.9.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