Skip to main content

Asyncio DynamoDB client

Project description

AsyncIO DynamoDB

CircleCI Code style: black Documentation Status

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

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

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

        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

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

aiodynamo-21.10.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

aiodynamo-21.10-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file aiodynamo-21.10.tar.gz.

File metadata

  • Download URL: aiodynamo-21.10.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.5 Darwin/20.6.0

File hashes

Hashes for aiodynamo-21.10.tar.gz
Algorithm Hash digest
SHA256 79e501ef4f0665d39603f1903bdd01358caf37ef5fd3a97d5813163d58ed928f
MD5 0fdaccf1171bc22113a6d1c9a878f2df
BLAKE2b-256 547e961114d9b09092239717ed942a93b12025c2eefe3b83a281bae60e8b734d

See more details on using hashes here.

Provenance

File details

Details for the file aiodynamo-21.10-py3-none-any.whl.

File metadata

  • Download URL: aiodynamo-21.10-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.5 Darwin/20.6.0

File hashes

Hashes for aiodynamo-21.10-py3-none-any.whl
Algorithm Hash digest
SHA256 483b56590e7faaf985c160ba6a587700c40f8138dbb9b73e4fa6d384c2edb298
MD5 0b8138eb6b58e0c9662898084086754f
BLAKE2b-256 8283ee4b5b2356ae1282e8e74ce438c0ca43b852dca1d27fd6f1600012dd8651

See more details on using hashes here.

Provenance

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