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:

  • 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.6.0.tar.gz (218.4 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.6.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

pydynox-0.6.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.7 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64

pydynox-0.6.0-cp314-cp314-macosx_11_0_arm64.whl (5.4 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pydynox-0.6.0-cp314-cp314-macosx_10_12_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

pydynox-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pydynox-0.6.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

pydynox-0.6.0-cp313-cp313-macosx_11_0_arm64.whl (5.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pydynox-0.6.0-cp313-cp313-macosx_10_12_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

pydynox-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pydynox-0.6.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

pydynox-0.6.0-cp312-cp312-macosx_11_0_arm64.whl (5.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pydynox-0.6.0-cp312-cp312-macosx_10_12_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

pydynox-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pydynox-0.6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

pydynox-0.6.0-cp311-cp311-macosx_11_0_arm64.whl (5.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pydynox-0.6.0-cp311-cp311-macosx_10_12_x86_64.whl (5.8 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for pydynox-0.6.0.tar.gz
Algorithm Hash digest
SHA256 72e89409c9c81bbf3d40fb4b8408edc73adc95e2ad1ed935fd71d80a73863704
MD5 b11efe2cc718d2b8112dad72ca0e1634
BLAKE2b-256 ec763dee5077a0884cfd8e4e1d2ff00051449fbe03d5e7e161a1ac20dee151d9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fc8a1c43bb3de02613acf7fdc9e95ddf993e3456f2368eb2e67abcfcb4da150c
MD5 bf08c16b7854ab26f01711e750b5d1c0
BLAKE2b-256 addeb1a379ff58f27ab8ef5b0b63673ba12bb052721dfd39cf526cd0db76e81a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e54b050bc2b2c05ad3a200f18d0251e8e426c59e872fc73607c298b2be780567
MD5 2e2f4ff71ee01a48048ae0a2a543cc10
BLAKE2b-256 852895326777a9228614c8588cf3496186be174e7a07b6b0fd5cd166286d10cd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8a418ad2a9ba9799ad422c93fd30761dc0f0c85caca95be9b7addd9c4d36f0fd
MD5 fd20a50ba6dca4ebd06f604a321ad1b1
BLAKE2b-256 5fb2e93d8a90295b5f18351361cd993864f6943ed0d7ee4cae3c9872e4d827f3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7ddd62d498e9436e0a5602e8c1fd07a0b514f5cdea7e7bba13ac3b7c00b3b1c3
MD5 b8610845afd57165e6604a00b2065917
BLAKE2b-256 ae9b296eb1ee93b745287735aa51fb0f5836f36661f2a5b022c3043549c62829

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0c38c38b28f2e9bd1e694a3b3b2f1e0c79e34ef20f501c7fd88c03c21a12c2bb
MD5 b2e42a7949ec6ab4168bdd04f8f91c4f
BLAKE2b-256 cd5d83ff13992285819067bb3773fb879141d5e985aab1059de340becb869138

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fd0eef82548f2b16e4557d278a5c2b41123fde2246c2c53895028fde86a34f4e
MD5 95d50ba1da889366c7ffea6ffbe1d7ca
BLAKE2b-256 b73c2663f295039e2b4a0930213cf47563e19e326a8afd8cb6019e48245de6ef

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c0510043eb377c4208f44dbbb4eb7335ce9f7b8a2384727be8ff78389edf7229
MD5 4edd8eb1c9507490b11e15e1fe16d006
BLAKE2b-256 55a056577929cb86ba96fea1546df2920748409b6942e5f1105b5592928b89b9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 cbdc4967845488730d6ed7179f9817f96f50e18e0bd35906a5bff1f55dd9be2c
MD5 52c216899a286f1e0841c9ab1024b357
BLAKE2b-256 23a381c117afee890962115925aef66a7be7cd0722b00b10de7ac28a3ba5fc11

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ddb74cc221c17d5b7840a309e87e441cbfbc702539b3e472f85f4e8274311b1e
MD5 43c26ec73f11cb6f16c9c293f5075aab
BLAKE2b-256 8a822fca0518fb902313e9066dd5f87669f016d152d2e85b80bbad1074ab44b0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c79918f15b080739177627f141e0da11dbab1ae3c145a9226fdc0f4e9d03375a
MD5 785023b6baed2febfff2123c8c824d4b
BLAKE2b-256 8955766606aa1da696d845b600600e29f5b72b0f484f98931ea8c450faf9288e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d36055fb39b1f17f8b713d6f2c2d32831aa5b1f50a45e944179436565b026216
MD5 c9f2abf377a6dc978dc16e9f8d7ec82c
BLAKE2b-256 3daa24a7d067657eb381fbce23132a4837f79893e29cb5f15e1ed913e544ef32

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1587b21e48b01880780032274b9039d11f20f173c1d60986fe04efabd1934fec
MD5 ef99e00fd0fc8f755021917402b6beaf
BLAKE2b-256 b6793ae2a4e6444cad31c1ab4768f9a162843a1e887c7ca73c5c088f9e469828

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e55aaba85933049c803911fdc53cbcfa404153d459999536249244d2286d315b
MD5 3cf88507033d8643e08286e852bedcd3
BLAKE2b-256 e1006dcbc8236690d1747feeaf763cce3f57b4c8612a8e74428b2fcc6f44417d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1fe81380f7ad311f1ae02fb0f5aaf9f8ddf6f402edec047213c0f5f7adfa23d1
MD5 933446b4683ec43eeb11965d3048566a
BLAKE2b-256 0f5d9018ee373f964ce7c0f45e64163be97adc34d63affec1bd766c1062033d6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0e5126ebd941afb8ec6588b492cb3199fd625ad5fe2d7d33bc76b19ee07195b7
MD5 434c882e7bb5509935257a6c52576d3f
BLAKE2b-256 1c72e8d7965566cf2baee9ff0995494bcb5937389377f25ecd17f68589dbdb6e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.6.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 dbecedb8a47a5759c3ae1a1f5a6e4cd329131d69b198bb79d6c5729e7e4e4c43
MD5 83f0a5761d273db0bf8110281ffe8cc6
BLAKE2b-256 c0bb15aa8aaec45cba77af02f237998dc9ab8ec9a02aab8bdb3ead0af1e13136

See more details on using hashes here.

Provenance

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