# AsyncIO DynamoDB
[![CircleCI](https://circleci.com/gh/HENNGE/aiodynamo.svg?style=svg)](https://circleci.com/gh/HENNGE/aiodynamo)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Documentation Status](https://readthedocs.org/projects/aiodynamo/badge/?version=latest)](https://aiodynamo.readthedocs.io/en/latest/?badge=latest)
Asynchronous pythonic DynamoDB client; **2x** faster than `aiobotocore/boto3/botocore`.
## Quick start
### With httpx
Install this library
`pip install "aiodynamo[httpx]"` or, for poetry users `poetry add aiodynamo -E httpx`
Connect to DynamoDB
```py
from aiodynamo.client import Client
from aiodynamo.credentials import Credentials
from aiodynamo.http.httpx import HTTPX
from httpx import AsyncClient
async with AsyncClient() as h:
client = Client(HTTPX(h), Credentials.auto(), "us-east-1")
```
### With aiohttp
Install this library
`pip install "aiodynamo[aiohttp]"` or, for poetry users `poetry add aiodynamo -E aiohttp`
Connect to DynamoDB
```py
from aiodynamo.client import Client
from aiodynamo.credentials import Credentials
from aiodynamo.http.aiohttp import AIOHTTP
from aiohttp import ClientSession
async with ClientSession() as session:
client = Client(AIOHTTP(session), Credentials.auto(), "us-east-1")
```
### API use
```py
table = client.table("my-table")
# Create table if it doesn't exist
if not await table.exists():
await table.create(
Throughput(read=10, write=10),
KeySchema(hash_key=KeySpec("key", KeyType.string)),
)
# Create or override an item
await table.put_item({"key": "my-item", "value": 1})
# Get an item
item = await table.get_item({"key": "my-item"})
print(item)
# Update an item, if it exists.
await table.update_item(
{"key": "my-item"}, F("value").add(1), condition=F("key").exists()
)
```
## Why aiodynamo
* boto3 and botocore are synchronous. aiodynamo is built for **asynchronous** apps.
* aiodynamo is **fast**. Two times faster than aiobotocore, botocore or boto3 for operations such as query or scan.
* aiobotocore is very low level. aiodynamo provides a **pythonic API**, using modern Python features. For example, paginated APIs are automatically depaginated using asynchronous iterators.
* **Legible source code**. botocore and derived libraries generate their interface at runtime, so it cannot be inspected and isn't typed. aiodynamo is hand written code you can read, inspect and understand.
* **Pluggable HTTP client**. If you're already using an asynchronous HTTP client in your project, you can use it with aiodynamo and don't need to add extra dependencies or run into dependency resolution issues.
[Complete documentation is here](https://aiodynamo.readthedocs.io/)
Raw data
{
"_id": null,
"home_page": "https://github.com/HENNGE/aiodynamo",
"name": "aiodynamo",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "dynamodb,asyncio,aws",
"author": "Jonas Obrist",
"author_email": "jonas.obrist@hennge.com",
"download_url": "https://files.pythonhosted.org/packages/f2/83/6f5d3018a5f07b63d57246c501526dad7c8562ec66482bc34e9c70444795/aiodynamo-24.1.tar.gz",
"platform": null,
"description": "# AsyncIO DynamoDB\n\n[![CircleCI](https://circleci.com/gh/HENNGE/aiodynamo.svg?style=svg)](https://circleci.com/gh/HENNGE/aiodynamo)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Documentation Status](https://readthedocs.org/projects/aiodynamo/badge/?version=latest)](https://aiodynamo.readthedocs.io/en/latest/?badge=latest)\n\nAsynchronous pythonic DynamoDB client; **2x** faster than `aiobotocore/boto3/botocore`.\n\n## Quick start\n\n### With httpx\nInstall this library\n\n`pip install \"aiodynamo[httpx]\"` or, for poetry users `poetry add aiodynamo -E httpx`\n\nConnect to DynamoDB\n\n```py\nfrom aiodynamo.client import Client\nfrom aiodynamo.credentials import Credentials\nfrom aiodynamo.http.httpx import HTTPX\nfrom httpx import AsyncClient\n\n async with AsyncClient() as h:\n client = Client(HTTPX(h), Credentials.auto(), \"us-east-1\")\n```\n\n### With aiohttp\nInstall this library\n\n`pip install \"aiodynamo[aiohttp]\"` or, for poetry users `poetry add aiodynamo -E aiohttp`\n\nConnect to DynamoDB\n\n```py\nfrom aiodynamo.client import Client\nfrom aiodynamo.credentials import Credentials\nfrom aiodynamo.http.aiohttp import AIOHTTP\nfrom aiohttp import ClientSession\n\n async with ClientSession() as session:\n client = Client(AIOHTTP(session), Credentials.auto(), \"us-east-1\")\n```\n\n### API use\n\n```py\n table = client.table(\"my-table\")\n\n # Create table if it doesn't exist\n if not await table.exists():\n await table.create(\n Throughput(read=10, write=10),\n KeySchema(hash_key=KeySpec(\"key\", KeyType.string)),\n )\n\n # Create or override an item\n await table.put_item({\"key\": \"my-item\", \"value\": 1})\n # Get an item\n item = await table.get_item({\"key\": \"my-item\"})\n print(item)\n # Update an item, if it exists.\n await table.update_item(\n {\"key\": \"my-item\"}, F(\"value\").add(1), condition=F(\"key\").exists()\n )\n```\n\n## Why aiodynamo\n\n* boto3 and botocore are synchronous. aiodynamo is built for **asynchronous** apps.\n* aiodynamo is **fast**. Two times faster than aiobotocore, botocore or boto3 for operations such as query or scan.\n* aiobotocore is very low level. aiodynamo provides a **pythonic API**, using modern Python features. For example, paginated APIs are automatically depaginated using asynchronous iterators.\n* **Legible source code**. botocore and derived libraries generate their interface at runtime, so it cannot be inspected and isn't typed. aiodynamo is hand written code you can read, inspect and understand.\n* **Pluggable HTTP client**. If you're already using an asynchronous HTTP client in your project, you can use it with aiodynamo and don't need to add extra dependencies or run into dependency resolution issues.\n\n[Complete documentation is here](https://aiodynamo.readthedocs.io/) \n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Asyncio DynamoDB client",
"version": "24.1",
"project_urls": {
"Documentation": "https://aiodynamo.readthedocs.io",
"Homepage": "https://github.com/HENNGE/aiodynamo",
"Repository": "https://github.com/HENNGE/aiodynamo"
},
"split_keywords": [
"dynamodb",
"asyncio",
"aws"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5c6c8d1d5dc1167cd9a8fb5d7e9a1e8b03516799c3a695b3678d1f9f02083f2a",
"md5": "7496f3e757bc61cc00f6bc638ce7cb57",
"sha256": "3824eb683cea58f8ba7c98cbb2ecdb35e2c5734949f632555879488d9274a1e5"
},
"downloads": -1,
"filename": "aiodynamo-24.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7496f3e757bc61cc00f6bc638ce7cb57",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 28528,
"upload_time": "2024-01-19T12:30:51",
"upload_time_iso_8601": "2024-01-19T12:30:51.299102Z",
"url": "https://files.pythonhosted.org/packages/5c/6c/8d1d5dc1167cd9a8fb5d7e9a1e8b03516799c3a695b3678d1f9f02083f2a/aiodynamo-24.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f2836f5d3018a5f07b63d57246c501526dad7c8562ec66482bc34e9c70444795",
"md5": "776023fdd1d1a463ed9f30a7013abf4e",
"sha256": "1ea5b659b1516db5c8c9f8ecceb4e7a6862e2390c062793d989224b1b01cfb85"
},
"downloads": -1,
"filename": "aiodynamo-24.1.tar.gz",
"has_sig": false,
"md5_digest": "776023fdd1d1a463ed9f30a7013abf4e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 25225,
"upload_time": "2024-01-19T12:30:53",
"upload_time_iso_8601": "2024-01-19T12:30:53.123421Z",
"url": "https://files.pythonhosted.org/packages/f2/83/6f5d3018a5f07b63d57246c501526dad7c8562ec66482bc34e9c70444795/aiodynamo-24.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-19 12:30:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "HENNGE",
"github_project": "aiodynamo",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aiodynamo"
}