Skip to main content

DynamoDB ODM for Python

Project description

DynamoDB Object Document Mapper (ODM) for Python

Installation

pip install dynamodm

Usage

from dynamodm import DynaModel, Field

class User(DynaModel):
	sub: str = Field(pk=True)
	name: str = Field(sk=True)
	age: int

user = User(sub="user", name="John Doe", age=42)

async def main():
	await user.put()
	# User(sub='user', name='John Doe', age=42)
	await User.get(pk="user", sk="John Doe")
	# User(sub='user', name='John Doe', age=42)
	await User.query(pk="user", sk="John Doe",operator="begins_with")
	# [User(sub='user', name='John Doe', age=42)]
	await User.delete(pk="user", sk="John Doe")
	# None
	

Features

  • Type hints
  • Automatic schema generation
  • Automatic table creation
  • Automatic table updates
  • Automatic table deletion

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

dynamodm-0.0.4.tar.gz (8.8 kB view hashes)

Uploaded Source

Built Distribution

dynamodm-0.0.4-py3-none-any.whl (10.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page