PynamoDB

A Pythonic, ORM-style interface to Amazon's DynamoDB.

Library
PyPI
v6.1.0
2,649stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
57/100Fair
Development Activity20
Maintenance32
Community76
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture84
Code Quality84
Innovation76
Learning Curve80

PynamoDB is an ORM-style library that gives Amazon DynamoDB a clean, Pythonic interface. You define tables as model classes with typed attribute fields, then create, query, scan, update, and delete items using intuitive Python objects instead of raw DynamoDB API calls.

It handles the low-level details of DynamoDB for you: automatic pagination over large result sets, batch and transactional operations, local and global secondary indexes, conditional writes, and rich update expressions. Fully type-annotated, PynamoDB works well with static type checkers and hides the verbosity of the underlying service behind a familiar model-based API.

What You Get

  • Declarative Model classes mapping DynamoDB tables to Python objects
  • Typed attribute fields (unicode, number, map, list, set, and more) with (de)serialization
  • Local and global secondary index support
  • Automatic pagination for query and scan results
  • Batch operations plus DynamoDB transactions (transact-get/transact-write)
  • Conditional writes and expressive update expressions
  • Full type annotations for static type checking

Common Use Cases

  • Modeling DynamoDB tables as Python classes in an application backend
  • Running paginated queries and scans without managing tokens manually
  • Performing batch or transactional writes across items
  • Enforcing conditional updates and optimistic concurrency on items

Under The Hood

Architecture - PynamoDB is organized around models.py (the Model metaclass that binds attributes and keys to a table), attributes.py (typed attribute descriptors handling serialization), and indexes.py for secondary indexes. Query construction lives in expressions/ (condition and update expression builders), pagination.py transparently walks paginated results, transactions.py implements transact operations, and the connection/ package wraps the actual DynamoDB HTTP API. signals.py offers pre/post operation hooks.

Tech Stack - Pure Python built on botocore for AWS request signing and transport, fully type-annotated (ships py.typed with a dedicated typing_tests/ suite and mypy.ini), packaged with setuptools, and tested via pytest. It targets DynamoDB specifically rather than general AWS access.

Code Quality - A mature, widely adopted project (nearly a million weekly downloads) with an extensive tests/ suite, separate typing tests, and benchmarks under bench/. The code is cleanly separated by concern (models, attributes, expressions, connection) and enforces static typing, though release cadence has slowed.

API Design - The developer experience is a major strength: defining a model reads like declaring a dataclass, and CRUD, query, and scan operations follow patterns familiar from Django-style ORMs. Attribute types, indexes, and update expressions are expressive without exposing DynamoDB’s verbose wire format, and comprehensive documentation with examples keeps onboarding smooth.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search