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.

⚠️ Alpha Software: This project is in early development. The API may change before v1.0. Use in production at your own risk. Contributions are welcome!

📋 Check the open issues to see what's planned and what's being worked on.

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, String, Number, Boolean, List

class User(Model):
    class Meta:
        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

class User(Model):
    class Meta:
        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://pydynox.readthedocs.io

License

MIT License

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.3.0.tar.gz (150.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.3.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64

pydynox-0.3.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ ARM64

pydynox-0.3.0-cp314-cp314-macosx_11_0_arm64.whl (4.8 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pydynox-0.3.0-cp314-cp314-macosx_10_12_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.14macOS 10.12+ x86-64

pydynox-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pydynox-0.3.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

pydynox-0.3.0-cp313-cp313-macosx_11_0_arm64.whl (4.8 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pydynox-0.3.0-cp313-cp313-macosx_10_12_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

pydynox-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pydynox-0.3.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

pydynox-0.3.0-cp312-cp312-macosx_11_0_arm64.whl (4.8 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pydynox-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

pydynox-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pydynox-0.3.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

pydynox-0.3.0-cp311-cp311-macosx_11_0_arm64.whl (4.8 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pydynox-0.3.0-cp311-cp311-macosx_10_12_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: pydynox-0.3.0.tar.gz
  • Upload date:
  • Size: 150.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.3.0.tar.gz
Algorithm Hash digest
SHA256 50b936fe6bea379617de974cb77b1597d4f86a36732732d0b004137ee2df75fb
MD5 bdcf469d1e1b4c64e76333278a3b85d0
BLAKE2b-256 28cb4bb4357ba3bfa6495d67a2670a0e9bdbc523f58976b4a1ff7ba3ec9d5aee

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9fd6feed0dafc1d085e3c67bf834c7ae53ff6b90b3c09387dd3ec731ef3fea4e
MD5 43a10fae78a2fc7697919e88ab14fa77
BLAKE2b-256 3282d2d02043e5def95bf535536c52c7bb9c423c97f10b9896cba5bf061cca08

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 46b4a65398ec38bd61dd0359b2d875ac0bf5c3a14928bd7fd7ea171e341d3914
MD5 4c84b79a9ca4c703b9efd467a31735a8
BLAKE2b-256 c360cc9b1cda2211243787871dfd45949c6263ea17c50a2a61bb815f83b3d4f7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 01bc66c04a46fe5bc848f629f2254588637c868b6795c0158bf2113cd7c841a5
MD5 144aefd32ec331828f43c2ccefa138b4
BLAKE2b-256 9becdfe8392ab0f001cc3192364e8fc7584ba451feb48b200cac7794ba8413e9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp314-cp314-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 165d5ef3b146258ff29116c9b0a2d65cf17d8bf965805c95def0ef4bbca5fc9a
MD5 4eeb6a704e58de64c6d5e10bbadf66c1
BLAKE2b-256 7a9a60238bd8e2ef646f119f667ffa55d343223d5623b13b720e74147b2ccfb6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5c3668f8de40e9b24af66aa5a4a3023011034780c47f00b5a553043ca384f7db
MD5 b94c4f762b3e4b825eb9a56cf1e8773a
BLAKE2b-256 ad99cb65993b1988ef641ec07385d7c3386fff37e6ba093ea7c9e2967280d89f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 537968de1d7035bc8fb264fd35c76ed92ddb406c957a71e7fb85ae38f6e8813c
MD5 ecd232d36e03c83a7982e76df59f0ab9
BLAKE2b-256 6a0f36ad9ab09c8f49383d9ff989185fe7937542981b73445840ffb83aa2b620

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 43e230eee1452baeb34c8d0a94325ae2d9e25fc4c46e3ac59c7f5d35369036ed
MD5 ccfb532c0f2cc0952402ee67270d7099
BLAKE2b-256 46d6aea1cf40677f22fe73da8d3c9186d6134bf8bc5914070facc7c3a1305fe4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 47a5ff20bd26ef3e45cd62ca8b9ad22283d6735088ac85665690f89410a28a47
MD5 463b1c459bbf9fc1adc5b0d52cb8cdd2
BLAKE2b-256 da5775de379435aa8a750367a43cc90ea1916796af61a7d92f69ee971a1c016a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fe3b5ffd6bbe8fad8e22ba406f8c72f9fcfcbcb688c5614412d532c10f5eb10a
MD5 13076ee9c24afe476ed7507675d1ab37
BLAKE2b-256 a74abe565c64a7e11e3b2a548e53d445443baa4649c2b0edcc98b5d840c885ec

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 afd6d25866d0b0fd668789e5ff459644fdd1b5c2864f22640e523a6e71929533
MD5 1103bef8d54b6aac295fc583557bc8ea
BLAKE2b-256 60f48e488eada86224123cc730fca8fcc819a995880bd71c03cb5685294c3ac3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 20ccf860d0ade6c1038c8dd05cfd65c17574bd23d485797a82780f1887fd2f90
MD5 0ed325c69c90bef23a56caab6419f1e2
BLAKE2b-256 dde9a2ddf3730221d407af8f0c2f005329fb8967568b43420f02b8611d0f33bd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c3ab84ca128a874a4f67f214e8f58327670ea33c902177f9147acf2402bf52a3
MD5 779a4e9eb03f9bc52a68511c16d6837d
BLAKE2b-256 24d11de3c4c34250a21c33d89f117c6f106f78ebf560fe31fec59aa68c4d0e11

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f26078b793e99c005f62d00feb91451584be417fa657b79710479ced63e9e20e
MD5 b49493199195d1fc7b3c14601fb3a91a
BLAKE2b-256 786a3aa77ee73d16e7dbfa315cf7910ce34fecccef66b624fb594b5f051b4156

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8ac027e3877bbf37b1e2f2cd056d19ac8eebea36c7e52de480cc5e623b71d3a8
MD5 59d9f4459a9a1664f28900560766bfc6
BLAKE2b-256 94f4c4ae2d796f93381db2a10108a1c6a693026c11b0527f8a83ff64eb6f3a21

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 120a90c3c8ce374b5343ba3ec25a21aaddd8f46dd24d97d23bb1e191b91be956
MD5 96e286656999f590771a05878d74eaa9
BLAKE2b-256 01ebce1024e7b3be3e2b6ceb6acb2d4258a68c532b1df57ced2327b1117689f4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pydynox-0.3.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 05ead8409f5212b2914524955683dba21f5cc9ea0e346f1107d0f07c328b43c7
MD5 8835981412e32ae8a9fbde69380628df
BLAKE2b-256 81462f6647efcc399a7cefb057d7465def2f73e938acc74d2c039a24fedb3e2c

See more details on using hashes here.

Provenance

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