aiodynamodb 0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aiodynamodb/__init__.py +109 -0
- aiodynamodb/py.typed +0 -0
- aiodynamodb-0.0.2.dist-info/METADATA +20 -0
- aiodynamodb-0.0.2.dist-info/RECORD +5 -0
- aiodynamodb-0.0.2.dist-info/WHEEL +4 -0
aiodynamodb/__init__.py
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""
|
|
2
|
+
aiodynamodb - Async DynamoDB ORM with Pydantic.
|
|
3
|
+
|
|
4
|
+
A modern, async-first DynamoDB ORM built on aioboto3 and Pydantic v2.
|
|
5
|
+
|
|
6
|
+
Example:
|
|
7
|
+
import aioboto3
|
|
8
|
+
from aiodynamodb import Model, table, init, HashKey, RangeKey, DynamoDateTime
|
|
9
|
+
from datetime import datetime
|
|
10
|
+
|
|
11
|
+
@table("users")
|
|
12
|
+
class User(Model):
|
|
13
|
+
user_id: HashKey[str]
|
|
14
|
+
created_at: RangeKey[DynamoDateTime]
|
|
15
|
+
name: str
|
|
16
|
+
email: str | None = None
|
|
17
|
+
|
|
18
|
+
async def main():
|
|
19
|
+
session = aioboto3.Session()
|
|
20
|
+
await init(session=session, models=[User])
|
|
21
|
+
|
|
22
|
+
# Create and save
|
|
23
|
+
user = User(
|
|
24
|
+
user_id="user_123",
|
|
25
|
+
created_at=datetime.now(),
|
|
26
|
+
name="Alice",
|
|
27
|
+
email="alice@example.com"
|
|
28
|
+
)
|
|
29
|
+
await user.save()
|
|
30
|
+
|
|
31
|
+
# Retrieve
|
|
32
|
+
user = await User.get(hash_key="user_123", range_key=user.created_at)
|
|
33
|
+
|
|
34
|
+
# Query
|
|
35
|
+
async for u in User.query(hash_key="user_123"):
|
|
36
|
+
print(u.name)
|
|
37
|
+
|
|
38
|
+
# Delete
|
|
39
|
+
await user.delete()
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
43
|
+
|
|
44
|
+
from aiodynamodb._init import close, init
|
|
45
|
+
from aiodynamodb.exceptions import (
|
|
46
|
+
AioDynamoDBError,
|
|
47
|
+
ConditionalCheckFailedError,
|
|
48
|
+
ItemNotFoundError,
|
|
49
|
+
NotInitializedError,
|
|
50
|
+
TableNotFoundError,
|
|
51
|
+
TransactionCancelledError,
|
|
52
|
+
ValidationError,
|
|
53
|
+
)
|
|
54
|
+
from aiodynamodb.fields import (
|
|
55
|
+
GSIHashKey,
|
|
56
|
+
GSIRangeKey,
|
|
57
|
+
HashKey,
|
|
58
|
+
LSIRangeKey,
|
|
59
|
+
RangeKey,
|
|
60
|
+
)
|
|
61
|
+
from aiodynamodb.model import Model, TableConfig, table
|
|
62
|
+
from aiodynamodb.operations import AsyncQuery, BatchWriteResult
|
|
63
|
+
from aiodynamodb.serializers import (
|
|
64
|
+
DynamoDate,
|
|
65
|
+
DynamoDateTime,
|
|
66
|
+
DynamoDecimal,
|
|
67
|
+
DynamoTime,
|
|
68
|
+
DynamoUUID,
|
|
69
|
+
enum_serializer,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
try:
|
|
73
|
+
__version__ = version("aiodynamodb")
|
|
74
|
+
except PackageNotFoundError:
|
|
75
|
+
__version__ = "0.0.0.dev0"
|
|
76
|
+
|
|
77
|
+
__all__ = [
|
|
78
|
+
# Core
|
|
79
|
+
"Model",
|
|
80
|
+
"table",
|
|
81
|
+
"TableConfig",
|
|
82
|
+
"init",
|
|
83
|
+
"close",
|
|
84
|
+
# Keys
|
|
85
|
+
"HashKey",
|
|
86
|
+
"RangeKey",
|
|
87
|
+
# Indexes
|
|
88
|
+
"GSIHashKey",
|
|
89
|
+
"GSIRangeKey",
|
|
90
|
+
"LSIRangeKey",
|
|
91
|
+
# Serializers
|
|
92
|
+
"DynamoDateTime",
|
|
93
|
+
"DynamoDate",
|
|
94
|
+
"DynamoTime",
|
|
95
|
+
"DynamoDecimal",
|
|
96
|
+
"DynamoUUID",
|
|
97
|
+
"enum_serializer",
|
|
98
|
+
# Operations
|
|
99
|
+
"AsyncQuery",
|
|
100
|
+
"BatchWriteResult",
|
|
101
|
+
# Exceptions
|
|
102
|
+
"AioDynamoDBError",
|
|
103
|
+
"NotInitializedError",
|
|
104
|
+
"ItemNotFoundError",
|
|
105
|
+
"TableNotFoundError",
|
|
106
|
+
"ConditionalCheckFailedError",
|
|
107
|
+
"TransactionCancelledError",
|
|
108
|
+
"ValidationError",
|
|
109
|
+
]
|
aiodynamodb/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: aiodynamodb
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Async DynamoDB ORM with Pydantic
|
|
5
|
+
Author: Nikhil Kumar
|
|
6
|
+
Author-email: Nikhil Kumar <nikumar1206@gmail.com>
|
|
7
|
+
Requires-Dist: aioboto3>=13.0.0
|
|
8
|
+
Requires-Dist: aiobotocore>=2.13.0
|
|
9
|
+
Requires-Dist: pydantic>=2.7.0
|
|
10
|
+
Requires-Dist: pytest>=9.0.2 ; extra == 'dev'
|
|
11
|
+
Requires-Dist: pytest-asyncio>=1.3.0 ; extra == 'dev'
|
|
12
|
+
Requires-Dist: ruff>=0.14.14 ; extra == 'dev'
|
|
13
|
+
Requires-Dist: aiomoto>=0.3.0 ; extra == 'testing'
|
|
14
|
+
Requires-Dist: moto[dynamodb]>=5.1.0 ; extra == 'testing'
|
|
15
|
+
Requires-Python: >=3.12
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Provides-Extra: testing
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# aiodynamodb
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
aiodynamodb/__init__.py,sha256=jDs7T1V2TbtaA3HuqIWwqBNpEFjr5k5-3mVAfvhpal0,2441
|
|
2
|
+
aiodynamodb/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
aiodynamodb-0.0.2.dist-info/WHEEL,sha256=fAguSjoiATBe7TNBkJwOjyL1Tt4wwiaQGtNtjRPNMQA,80
|
|
4
|
+
aiodynamodb-0.0.2.dist-info/METADATA,sha256=JUnYMLYK72IR_8-oOKk2u16Y3t5Trc1yuhLKYSZaQTc,645
|
|
5
|
+
aiodynamodb-0.0.2.dist-info/RECORD,,
|