Dynamo Dao
Project description
Dynamo Dao
Library for interacting with DynamoDb tables.
Installation
pip install dynamo-dao
Usage
from typing import NamedTuple
from dynamo_dao import Dao, DynamoObject
class Example(NamedTuple):
foo: str
bar: int
class ExampleDao(Dao[Example]):
table_name = "example"
unique_key = ["foo"]
def convert_to_dynamo(self, var: Example) -> DynamoObject:
return {"foo": var.foo, "bar": var.bar}
def convert_from_dynamo(self, var: DynamoObject) -> Example:
return Example(foo=str(var["foo"]), bar=int(var["bar"]))
example_dao = ExampleDao()
example = Example(foo="hi", bar=1)
example_dao.create(example)
result = example_dao.read_one("foo", "hi")
assert example == result
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
dynamo-dao-0.0.1.tar.gz
(2.4 kB
view details)
Built Distribution
File details
Details for the file dynamo-dao-0.0.1.tar.gz
.
File metadata
- Download URL: dynamo-dao-0.0.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58dc84eba5c3d7572f6ccb67c9e95f51e269f0fdd46577bf16e555ffb16e8170 |
|
MD5 | 6609a953e505ce1fc2a6f43d37853fe2 |
|
BLAKE2b-256 | a9f4063fb4eb8233afa50e60ade7e5938f26d56bb30ca3a221eb2442bc138d74 |
File details
Details for the file dynamo_dao-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: dynamo_dao-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fac753baefb9535fc0dc28ae7e072d692babed79f5302b159c3b5d1ee62c2ccb |
|
MD5 | c1789a26af3820c1bd9791ccb4ea7ef7 |
|
BLAKE2b-256 | 2b1a24507b253c9b3ccfa4c94b00569979b446159077a55fb823a0b32e4f6947 |