Skip to main content

dynamoxy

A typed, async DynamoDB ORM for Python, with a Rust core. Declare models with type hints (or pydantic) and get validated, atomic DynamoDB access, plus an in-memory DynamoDB for your tests.

import asyncio
from datetime import datetime

import dynamoxy
from dynamoxy import Attr, field, partition_key


class User(dynamoxy.Model, table="users"):
    user_id: Attr[str] = partition_key()
    email: Attr[str] = field(unique=True)
    name: Attr[str] = field(min_length=1)
    visits: Attr[int] = field(default=0)
    created_at: Attr[datetime] = dynamoxy.created_at()
    version: Attr[str] = dynamoxy.version()

    by_email = dynamoxy.GlobalIndex(partition_key=email)


async def main() -> None:
    async with dynamoxy.Client(region="eu-west-1") as client:  # or dynamoxy.testing.memory_client()
        await client.ensure_tables(User)

        ada = await User.create(client, user_id="u1", email="ada@example.com", name="Ada")
        await ada.increment(User.visits)  # atomic; `ada` is refreshed in place
        ada.name = "Ada Lovelace"
        await ada.save()  # only if nobody changed it meanwhile (version)

        try:
            await User.create(client, user_id="u2", email="ada@example.com", name="Imposter")
        except dynamoxy.UniqueConstraintError as error:
            print(f"{error.field} is taken")

        found = await User.query(client, index=User.by_email, email="ada@example.com").first()
        print(found)


asyncio.run(main())

Highlights

  • Typed end to end. Fields are values on instances and typed paths on the class (User.visits > 3). Your type checker catches User(visits="3") and User.visits > "3".

  • Errors that tell you what to fix. DynamoDB's rules are checked before a request is sent:

    ValidationError: the transaction has 120 operations (guard items of unique attributes included); DynamoDB allows 100
    

    A refused write raises ItemAlreadyExistsError, VersionConflictError or UniqueConstraintError, not a bare ConditionalCheckFailedException.

  • Writes that mean what they say. create() never overwrites, save() checks the version, update() is atomic without a read.

  • Unique values, timestamps and versions are maintained for you.

  • Retries built in, with backoff and jitter. Nothing fails silently.

  • An in-memory DynamoDB for tests. No Docker, no AWS account. It refuses what DynamoDB refuses, simulates faults and answers in microseconds:

    dynamoxy.testing.inject_fault(client, operation="GetItem", error="throttling", times=2)
    with dynamoxy.collect() as usage:
        user = await User.get(client, "u1")  # throttled twice, retried
    assert usage.retries == 2
    
  • Observable. Structured logs and event hooks out of the box; OpenTelemetry spans and metrics when you configure it. Item contents are never logged.

  • Single-table design with key templates such as "CUSTOMER#{customer_id}".

  • Fast. 2.5 to 5 times less client CPU per call than boto3 (numbers).

  • No required dependencies. pydantic and OpenTelemetry are optional extras.

Also covered: indexes, cursors, batches, transactions, TTL, streams, backups, PartiQL and table management.

Already using pydantic?

Inherit from dynamoxy.PydanticModel instead of BaseModel and mark the key. Pydantic keeps validating, and the class stays a pydantic model, so the same Customer can be a FastAPI request or response model and a DynamoDB table (uv add 'dynamoxy[pydantic]'):

from typing import Annotated

from pydantic import BaseModel, Field

import dynamoxy


class Address(BaseModel):  # plain pydantic models nest as maps
    street: str
    city: str


class Customer(dynamoxy.PydanticModel, table="customers"):  # instead of BaseModel
    customer_id: Annotated[str, dynamoxy.PartitionKey()]
    email: Annotated[str, dynamoxy.Unique()]
    name: str = Field(min_length=1)
    address: Address | None = None


await client.ensure_tables(Customer)
customers = client.model(Customer)
await customers.create(Customer(customer_id="c1", email="ada@example.com", name="Ada"))
customer = await customers.get("c1")  # a validated Customer

A model you would rather not touch can stay as it is: subclass it together with dynamoxy.PydanticModel and re-declare only the fields that need a marker, such as the key (see the pydantic guide).

Install

uv add dynamoxy               # or: pip install dynamoxy
uv add 'dynamoxy[pydantic]'   # pydantic models
uv add 'dynamoxy[otel]'       # OpenTelemetry

Documentation

Getting started First model, connecting, first queries
Usage guide The compact reference (dynamoxy guide)
Guides Modeling, reading, writing, transactions, single-table design, testing, ...
Examples Runnable programs
Reference Configuration, errors, events
Architecture How it works, invariants, decisions
Parity with DynamoDB DynamoDB's answers next to the in-memory backend's, MiniStack's and LocalStack's
Changelog Release notes

AI agents: run dynamoxy guide (or read AGENT_GUIDE.md) before writing code with dynamoxy; application repositories can copy the skill in skills/dynamoxy. Agents changing dynamoxy itself start with AGENTS.md.

Tested against DynamoDB

The in-memory backend is checked against DynamoDB itself, not only against emulators. A probe runs dynamoxy's operations on real DynamoDB and on each backend, and compares what comes back: results, error codes and messages, size limits, transaction payload sizes and table states.

Answers like DynamoDB Used for
In-memory backend Every probed fact Your tests, and dynamoxy's
MiniStack Most results; accepts much of what DynamoDB refuses (filters on attributes an index does not hold, size limits, changes to a table being created) dynamoxy's end-to-end tests and CI
LocalStack Closer than MiniStack (DynamoDB Local inside); its free edition lacks backups and point-in-time recovery dynamoxy's end-to-end tests, locally

So a request DynamoDB would refuse fails in your tests on the in-memory backend too, while an emulator that accepts a request is no proof that DynamoDB will. Every answer, with the probe that asked it, is in docs/parity.

How it works

A Rust core speaks DynamoDB: the AWS SDK for transport, plus dynamoxy's own retries, batching, events and the in-memory backend. Python owns what you touch: models, validation, repositories and hooks. A few choices worth knowing:

  • Values never go into expression strings, so reserved words and injection are non-issues.
  • Unique values are guard items written in the same transaction, since indexes are only eventually consistent.
  • Models hold no client, so one model works with several accounts, regions or test stores.
  • Stored formats are API: they stay readable across versions.

The architecture and the decision records have the details.

Performance

Round trips cost every client the same. What a library adds is CPU time per call, spent holding the GIL. dynamoxy does the protocol work in Rust.

Client CPU time per call against a local emulator (dynamoxy returns validated models; the others return DynamoDB JSON):

dynamoxy boto3 aiobotocore
GetItem, one item 0.14 ms 0.66 ms 0.60 ms
PutItem, one item 0.19 ms 0.67 ms 0.61 ms
Query, 100 items 0.65 ms 1.68 ms 1.71 ms
  • Cold start (import and first read): 51 ms, against 115 ms for boto3.
  • In memory, a get() takes about 13 µs, so large test suites run in seconds.

Why it is fast: signing, HTTP, JSON and retries run in Rust outside the GIL; each model plans its encoding once, when the class is created; and features you do not use cost nothing.

Measured with dynamoxy 0.2.0 on Python 3.14, aarch64 Linux, October 2026. Your hardware will differ: scripts/benchmark.py measures it on yours.

Contributing

See CONTRIBUTING.md. The project is young (0.x): breaking changes are possible in minor versions and are called out in the changelog.

License

MIT

Metadata

Release files for dynamoxy 0.7.0

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

Source distribution (sdist)

Source distribution for dynamoxy 0.7.0
File Size Uploaded Provenance Actions
dynamoxy-0.7.0.tar.gz 452.2 kB With provenance Details for dynamoxy-0.7.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for dynamoxy 0.7.0
File Actions
dynamoxy-0.7.0-cp312-abi3-win_arm64.whl CPython 3.12 abi3 Windows ARM64 Details for dynamoxy-0.7.0-cp312-abi3-win_arm64.whl
dynamoxy-0.7.0-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for dynamoxy-0.7.0-cp312-abi3-win_amd64.whl
dynamoxy-0.7.0-cp312-abi3-musllinux_1_2_x86_64.whl CPython 3.12 abi3 Linux musl 1.2+ x86-64 Details for dynamoxy-0.7.0-cp312-abi3-musllinux_1_2_x86_64.whl
dynamoxy-0.7.0-cp312-abi3-musllinux_1_2_aarch64.whl CPython 3.12 abi3 Linux musl 1.2+ ARM64 Details for dynamoxy-0.7.0-cp312-abi3-musllinux_1_2_aarch64.whl
dynamoxy-0.7.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details for dynamoxy-0.7.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
dynamoxy-0.7.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details for dynamoxy-0.7.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
dynamoxy-0.7.0-cp312-abi3-macosx_11_0_x86_64.whl CPython 3.12 abi3 macOS 11.0+ x86-64 Details for dynamoxy-0.7.0-cp312-abi3-macosx_11_0_x86_64.whl
dynamoxy-0.7.0-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for dynamoxy-0.7.0-cp312-abi3-macosx_11_0_arm64.whl

Total release size: 48.4 MB

Release files / dynamoxy-0.7.0.tar.gz

Download URL dynamoxy-0.7.0.tar.gz
Size 452.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b593e97779605e22cbd6cef36ac26ef2cae85651c36391cb12a049a02cbc4a20
BLAKE2b-256 checksum
How to use checksums
614bfc8e249610bb41bd7f91b1d3c2c955339c78927aaf12813e8a0e3aa17b53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / dynamoxy-0.7.0-cp312-abi3-win_arm64.whl

Download URL dynamoxy-0.7.0-cp312-abi3-win_arm64.whl
Size 6.0 MB
Tags CPython 3.12 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
43b69a49b96ae499daf05cd3e7d0efd3f6339621a6368e267928af7057c612c6
BLAKE2b-256 checksum
How to use checksums
e55d1ae0ebb800dc5cd2e4693db4141c3accbbff611b00f089f8df286f4dbd53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / dynamoxy-0.7.0-cp312-abi3-win_amd64.whl

Download URL dynamoxy-0.7.0-cp312-abi3-win_amd64.whl
Size 6.3 MB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
695a2fd1a83481aba98ebfe864a3b11180155c49391c7d10f2fa7600b37019d2
BLAKE2b-256 checksum
How to use checksums
a3b91d068fc43c503ddfba90d018cccb62e014b88bd3535fd5c0c5f9dd296b94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / dynamoxy-0.7.0-cp312-abi3-musllinux_1_2_x86_64.whl

Download URL dynamoxy-0.7.0-cp312-abi3-musllinux_1_2_x86_64.whl
Size 6.2 MB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
594ae417cebb2b710474d5a4b8a41adcd63a6f369a3bf7a92b003dcd4e35e8ce
BLAKE2b-256 checksum
How to use checksums
545350d4391f3cfd436d206cb05b1abdfc2455b521b250d9ae7b29abd18e35e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / dynamoxy-0.7.0-cp312-abi3-musllinux_1_2_aarch64.whl

Download URL dynamoxy-0.7.0-cp312-abi3-musllinux_1_2_aarch64.whl
Size 5.8 MB
Tags CPython 3.12 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
0eed7651a60c392a3de88778c508ee57a53cdf175b1e10b5bb2921bf88b3dd46
BLAKE2b-256 checksum
How to use checksums
919a90a6fa2b8e7ac6b463d7930559841a70bafd2caa0468da5d069259916923
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / dynamoxy-0.7.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL dynamoxy-0.7.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 6.2 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
a057f05b7d82e883ad718646f3031e1b69977bd44a88200f970185b21dfbe3be
BLAKE2b-256 checksum
How to use checksums
a5e9993e37b7912ed76570a5f7c87f6051911f1a5c861a7ba163e4138c93b1af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / dynamoxy-0.7.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL dynamoxy-0.7.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 5.8 MB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
e99ca36fab7c911040e69f67081826c959a06bfbcdb5d9b84913b340b403fa5e
BLAKE2b-256 checksum
How to use checksums
c61f731fdc82bf8ca543214ff53a9c5d2fef23bc3b2ef90bc3656bd208a56871
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / dynamoxy-0.7.0-cp312-abi3-macosx_11_0_x86_64.whl

Download URL dynamoxy-0.7.0-cp312-abi3-macosx_11_0_x86_64.whl
Size 6.0 MB
Tags CPython 3.12 abi3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
ef8aa092581bbce80eda7c3dd25730f7cf23adbaaa3235c4d7dacb7d04a6b92c
BLAKE2b-256 checksum
How to use checksums
4ff0e08f66869fc89591a9d33e9965536a720537346623136f529f648768947f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / dynamoxy-0.7.0-cp312-abi3-macosx_11_0_arm64.whl

Download URL dynamoxy-0.7.0-cp312-abi3-macosx_11_0_arm64.whl
Size 5.6 MB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3fc9d122a2659a83c15a3876b1b7ff4aaeb1c11ce9a9bca85bde125e8307cf57
BLAKE2b-256 checksum
How to use checksums
f8771a75c8b3cc15446f656724f571e55523e766c10f313ca99bda9d2793c4b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for dynamoxy 0.7.0

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.

Full provenance

All 9 files in this release have been uploaded with provenance metadata.

Select from 9 files

Attestation for dynamoxy-0.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

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