Name | simplesingletable JSON |
Version |
4.1.0
JSON |
| download |
home_page | None |
Summary | A simple boto3/Pydantic implementation of DynamoDB Single Table Design and related utilities. |
upload_time | 2024-06-12 23:32:19 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | The MIT License (MIT) Copyright © 2023 <copyright holders> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
dynamodb
singletabledesign
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Simple Single Table
**Latest Version:** 4.1.0
**simplesingletable** is a Python library that offers an abstraction layer for AWS DynamoDB operations, particularly for
those tables using single-table design. It uses Pydantic to define the models, and tries to be as "batteries-included"
based on how I personally have come to use DynamoDb.
I've used and written variations of this same code many times, and finally decided to try and package it all up into a
single library I could pip install and use whenever I needed cheap, easy, fast storage with few access patterns. So far
this is working quite well for the way I use DynamoDb and the assumptions that are true for me, such as:
* My apps are generally pretty small scale -- a few hundred users at a time max
* My collection sizes are pretty small -- tens or hundreds of thousands, not millions or billions
In this scenario I've found DynamoDb to be an extremely valuable tool that can perform extremely fast and consistently,
and essentially for free or very little cost. I believe most of these tools and techniques would scale beyond that,
but cannot personally attest to it.
## Key Features
There are many ways to use DynamoDb. These are the things I've come to want:
* A single table where I can store different types of Objects (Pydantic Models)
* Automatic resource ID creation using a lexicographically sortable ID (via `ulid-py`); this is very useful for setting
up alternative access patterns using the secondary indices and having them sort by creation date of the objects.
* Simple way to list, paginate, and filter by object type, sortable by last updated time, seamlessly blending DynamoDb
filter expressions and server side filtering on the loaded Pydantic models using simple python functions
* Automatic versioning for created resources -- every update generates a new version, and the complete version history
is maintained and easily accessed; additionally the code prevents simultaneous writes from the same version; updates
can only be performed from the latest version of an object.
* Powerful query function for enabling secondary access patterns using GSIs as needed
## Installation:
```bash
pip install simplesingletable
```
# Usage
Docs, examples, and access patterns coming soon!
Here's a brief demo of how to utilize:
```python
# How to Use:
# 1. Define a Resource:
# Resources are essentially DynamoDB items. They can be defined by subclassing `DynamodbVersionedResource`:
from simplesingletable import DynamodbVersionedResource, DynamoDBMemory
class MyTestResource(DynamodbVersionedResource):
some_field: str
bool_field: bool
list_of_things: list[str | int | bool | float]
# 2. CRUD Operations
from logzero import logger
dynamodb_memory = DynamoDBMemory(logger=logger, table_name="my-dynamodb-table")
resource = dynamodb_memory.create_new(MyTestResource, {})
retrieved = dynamodb_memory.read_existing(resource.resource_id, MyTestResource)
updated_resource = dynamodb_memory.update_existing(retrieved, {})
```
More coming soon...
# Testing:
The package includes a comprehensive test suite to ensure reliability and robustness. Use the test_simplesingletable.py
as a reference for the functionalities available until more documentation is available.
Raw data
{
"_id": null,
"home_page": null,
"name": "simplesingletable",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "dynamodb, singletabledesign",
"author": null,
"author_email": "Sully <sully@sadburger.com>",
"download_url": "https://files.pythonhosted.org/packages/b4/7c/317194eb3f8596f3d36bd047839f4fc31ab78f5379825de0dd9e089b2a1f/simplesingletable-4.1.0.tar.gz",
"platform": null,
"description": "# Simple Single Table\n\n**Latest Version:** 4.1.0\n\n**simplesingletable** is a Python library that offers an abstraction layer for AWS DynamoDB operations, particularly for\nthose tables using single-table design. It uses Pydantic to define the models, and tries to be as \"batteries-included\"\nbased on how I personally have come to use DynamoDb.\n\nI've used and written variations of this same code many times, and finally decided to try and package it all up into a\nsingle library I could pip install and use whenever I needed cheap, easy, fast storage with few access patterns. So far\nthis is working quite well for the way I use DynamoDb and the assumptions that are true for me, such as:\n\n* My apps are generally pretty small scale -- a few hundred users at a time max\n* My collection sizes are pretty small -- tens or hundreds of thousands, not millions or billions\n\nIn this scenario I've found DynamoDb to be an extremely valuable tool that can perform extremely fast and consistently,\nand essentially for free or very little cost. I believe most of these tools and techniques would scale beyond that,\nbut cannot personally attest to it.\n\n## Key Features\n\nThere are many ways to use DynamoDb. These are the things I've come to want:\n\n* A single table where I can store different types of Objects (Pydantic Models)\n* Automatic resource ID creation using a lexicographically sortable ID (via `ulid-py`); this is very useful for setting\n up alternative access patterns using the secondary indices and having them sort by creation date of the objects.\n* Simple way to list, paginate, and filter by object type, sortable by last updated time, seamlessly blending DynamoDb\n filter expressions and server side filtering on the loaded Pydantic models using simple python functions\n* Automatic versioning for created resources -- every update generates a new version, and the complete version history\n is maintained and easily accessed; additionally the code prevents simultaneous writes from the same version; updates\n can only be performed from the latest version of an object.\n* Powerful query function for enabling secondary access patterns using GSIs as needed\n\n## Installation:\n\n```bash\npip install simplesingletable\n```\n\n# Usage\n\nDocs, examples, and access patterns coming soon!\n\nHere's a brief demo of how to utilize:\n\n```python\n\n# How to Use:\n# 1. Define a Resource:\n# Resources are essentially DynamoDB items. They can be defined by subclassing `DynamodbVersionedResource`:\n\nfrom simplesingletable import DynamodbVersionedResource, DynamoDBMemory\n\n\nclass MyTestResource(DynamodbVersionedResource):\n some_field: str\n bool_field: bool\n list_of_things: list[str | int | bool | float]\n\n\n# 2. CRUD Operations\nfrom logzero import logger\n\ndynamodb_memory = DynamoDBMemory(logger=logger, table_name=\"my-dynamodb-table\")\nresource = dynamodb_memory.create_new(MyTestResource, {})\nretrieved = dynamodb_memory.read_existing(resource.resource_id, MyTestResource)\nupdated_resource = dynamodb_memory.update_existing(retrieved, {})\n```\n\nMore coming soon...\n\n# Testing:\n\nThe package includes a comprehensive test suite to ensure reliability and robustness. Use the test_simplesingletable.py\nas a reference for the functionalities available until more documentation is available.\n",
"bugtrack_url": null,
"license": "The MIT License (MIT) Copyright \u00a9 2023 <copyright holders> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \u201cSoftware\u201d), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \u201cAS IS\u201d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "A simple boto3/Pydantic implementation of DynamoDB Single Table Design and related utilities.",
"version": "4.1.0",
"project_urls": {
"Homepage": "https://github.com/msull/simplesingletable"
},
"split_keywords": [
"dynamodb",
" singletabledesign"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b7568668f78a15cd630f7e220d6ede2e6a0839908648af34e777fdae0ac32cdd",
"md5": "e8e55c1e924c326ba9fe049638a9781d",
"sha256": "ca0081624ddcc3c0232669079e56d7e51b8324727dadc9ac5f0454ca3bd8b050"
},
"downloads": -1,
"filename": "simplesingletable-4.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e8e55c1e924c326ba9fe049638a9781d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 29221,
"upload_time": "2024-06-12T23:32:17",
"upload_time_iso_8601": "2024-06-12T23:32:17.395539Z",
"url": "https://files.pythonhosted.org/packages/b7/56/8668f78a15cd630f7e220d6ede2e6a0839908648af34e777fdae0ac32cdd/simplesingletable-4.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b47c317194eb3f8596f3d36bd047839f4fc31ab78f5379825de0dd9e089b2a1f",
"md5": "3fda8641c80ab533ef1b2e6a77197ac0",
"sha256": "f1995aff1fb84a613c54bb4441e018db9cd51b72cdc1063ba54c46f053225bb3"
},
"downloads": -1,
"filename": "simplesingletable-4.1.0.tar.gz",
"has_sig": false,
"md5_digest": "3fda8641c80ab533ef1b2e6a77197ac0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 30466,
"upload_time": "2024-06-12T23:32:19",
"upload_time_iso_8601": "2024-06-12T23:32:19.070017Z",
"url": "https://files.pythonhosted.org/packages/b4/7c/317194eb3f8596f3d36bd047839f4fc31ab78f5379825de0dd9e089b2a1f/simplesingletable-4.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-12 23:32:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "msull",
"github_project": "simplesingletable",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "simplesingletable"
}