DynamoDB Not ORM
A lightweight DynamoDB ORM alternative that provides a simple way to work with DynamoDB without the complexity of a full ORM.
Features
- Simple data model definition with dataclasses
- Type-safe field access and updates
- Migration system for schema changes
- CLI tools for database operations
Installation
pip install dynamodb-not-orm
Quick Start
from dataclasses import dataclass, field
from dynamodb_not_orm import DataModel, F
from aiodynamo.models import ReturnValues
@dataclass
class UserProfile(DataModel):
full_name: str | None = None
@dataclass
class UserDataModel(DataModel):
__table__ = "users"
__pk__ = "user_id"
__sk__ = "email"
user_id: str | None = None
email: str | None = None
name: str | None = None
age: int | None = None
profile: UserProfile | None = field(default_factory=UserProfile)
# Create a user
user = UserDataModel(user_id="123", email="user@example.com", name="John Doe", age=30)
# Get the key for DynamoDB operations
key = user.key # {'user_id': '123', 'email': 'user@example.com'}
# Create a key for a specific user
key = UserDataModel.key("123", "user@example.com") # {'user_id': '123', 'email': 'user@example.com'}
# create CRUD model
from dynamodb_not_orm import BaseCRUD
class UserCRUD(BaseCRUD[UserDataModel]):
...
user_crud = UserCRUD('eu-east-1', 'dev')
user = await user_crud.update(user.key, user.to_update_expression(), return_values=ReturnValues.all_new)
await user_crud.update(user.key, F(UserDataModel.profile.full_name).set("John Doe"))
await user_crud.update(
user.key, F.and_(
F(UserDataModel.age).set(18),
F(UserDataModel.profile.full_name).set("Jane Doe"),
)
)
CLI Usage
Initialize the migration system:
not-orm init --aws-region us-east-1 --environment dev --app-name myapp
Create a new migration:
not-orm create-empty "add user table"
Run migrations:
not-orm migrate --aws-region us-east-1 --environment dev --app-name myapp
License
MIT License
Metadata
Release files for dynamodb-not-orm 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dynamodb_not_orm-0.1.3.tar.gz | 7.7 kB | Without provenance | Details for dynamodb_not_orm-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dynamodb_not_orm-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for dynamodb_not_orm-0.1.3-py3-none-any.whl |
Total release size: 17.2 kB
Release files / dynamodb_not_orm-0.1.3.tar.gz
| Download URL | dynamodb_not_orm-0.1.3.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d51e30c28f5e644b3ba9a0976cdd3f6766801d90bcd95aa0166f7e0257215c2
|
|
BLAKE2b-256 checksum How to use checksums |
6623710aa0168dd733c45056967b2996ed54af98e086fa8a088ee0e6c3439c29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / dynamodb_not_orm-0.1.3-py3-none-any.whl
| Download URL | dynamodb_not_orm-0.1.3-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8a9b2d1238692a42545bb445faa1d20bff78a4fcd973165720f4c5edbd9b9d8b
|
|
BLAKE2b-256 checksum How to use checksums |
a9300dc65d1169d2a66ce0e939ef214e83b144ebd9798a97221fbb39688e731c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for dynamodb-not-orm 0.1.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.