Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

DynamoClasses

API interface for Amazon Web Services DynamoDB built on top of PEP 557 Data Classes.

The goal is to have something that is fully a dataclass class, but gets some helpers bolted on allowing for retrieving/storing the objects in DynamoDB.

Basic Usage

>>> import botocore
>>>
>>> from moto import mock_dynamodb2
>>>
>>> from dynamoclasses import dynamoclass
>>>
>>> mock_dynamodb2().start()
>>>
>>> session = botocore.session.get_session()
>>> client = session.create_client("dynamodb")
>>> client.create_table(
...     TableName="inventory",
...     KeySchema=[
...         {"AttributeName": "item_id", "KeyType": "HASH"},
...     ],
...     AttributeDefinitions=[
...         {"AttributeName": "item_id", "AttributeType": "S"},
...     ],
...     ProvisionedThroughput={"ReadCapacityUnits": 1, "WriteCapacityUnits": 1},
... )
{'TableDescription': ...}
>>>
>>> @dynamoclass(table_name="inventory", partition_key_name="item_id")
... class InventoryItem:
...     item_id: str
...
>>> item = InventoryItem("hammers")
>>> item.save()
{'Attributes': ...}
>>>
>>> found_item = InventoryItem.get(partition_key="hammers", sort_key=None)
>>>
>>> print(found_item.item_id)
hammers

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dynamoclasses-1.0.0a2.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dynamoclasses-1.0.0a2-py2.py3-none-any.whl (4.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file dynamoclasses-1.0.0a2.tar.gz.

File metadata

  • Download URL: dynamoclasses-1.0.0a2.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for dynamoclasses-1.0.0a2.tar.gz
Algorithm Hash digest
SHA256 d67f05ac42bfcb60d25403305dd4a924b6eac100867ea38b4325bae0939cfaf9
MD5 10d9585469d66931173e536397ccae22
BLAKE2b-256 ecf2f321c3647ef79603412c9d6817d2ef3e860548606088cce9a2b499d3d075

See more details on using hashes here.

File details

Details for the file dynamoclasses-1.0.0a2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for dynamoclasses-1.0.0a2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bbbbc572f2bc488b8298bdc99d345ace0f34654eac2e1de04c0f928f04eb90a4
MD5 09ad2e8640b221add771933f80c60455
BLAKE2b-256 13b0f7da35ebce90dccd9f650199006a8c9630cce9c6a6e08026ecbeaa134771

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0a2 This release

2 files

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