Skip to main content

asyncio wrapper of PynamoDB

Project description

InPynamoDB

Build Status Coverage Status

This transforms PynamoDB's basic methods working asynchronously used aiobotocore.

This library may be merged into PynamoDB as a feature of it, but for the time being, you can use this library if you need to run any operation on DynamoDB asynchronously.

From introduction of PynamoDB:

A Pythonic interface for Amazon's DynamoDB that supports Python 2 and 3. (InPynamoDB supports from Python 3.6 because this uses async/await.)

DynamoDB is a great NoSQL service provided by Amazon, but the API is verbose. PynamoDB presents you with a simple, elegant API.

Requirements

  • Python 3.6 and above for this library is using async/await keyword.

Installation

$ pip install InPynamoDB

Basic Usage

This library is not well-documented. If you know how to use asyncio with async/await syntax, you will know where to change from PynamoDB syntax since it is very intuitive to use if you know how to use PynamoDB and asyncio.

Detailed document will be available, soon. (Please bear with me)

For the time being, please refer to PynamoDB documentation.

Defining model

from inpynamodb.models import Model
from inpynamodb.attributes import UnicodeAttribute

class UserModel(Model):
    """
    A DynamoDB User
    """
    class Meta:
        table_name = "dynamodb-user"
    email = UnicodeAttribute(null=True)
    first_name = UnicodeAttribute(range_key=True)
    last_name = UnicodeAttribute(hash_key=True)


# you can declare model:
user = UserModel(email="hgd@testing.com", first_name="gildong", last_name="hong")

Basic Manipulation

# GET
user = await UserModel.get(hash_key="John", range_key="Doe")

# BATCH_GET
async for user in UserModel.batch_get(keys):  # `keys` argument should be list.
    print(user.id)
    # ...
  • UPDATE
await user.update(actions=[UserModel.first_name.set("new_first_name")])

Contribution

Any form of contribution is always welcome! This library uses poetry as package manager, so you have to install poetry to install required packages.

Please leave issues in any form, I will check ASAP.

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

InPynamoDB-4.1.3.tar.gz (53.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

InPynamoDB-4.1.3-py3-none-any.whl (60.0 kB view details)

Uploaded Python 3

File details

Details for the file InPynamoDB-4.1.3.tar.gz.

File metadata

  • Download URL: InPynamoDB-4.1.3.tar.gz
  • Upload date:
  • Size: 53.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for InPynamoDB-4.1.3.tar.gz
Algorithm Hash digest
SHA256 2aa37dc01a5dcbfbd467f84d9490e97dcb6cc7a7029337662f64c55ab60dddc1
MD5 98e3052a2d80f11e168779e129857166
BLAKE2b-256 a90a1e6ede440200daa623d5af73ccde61f5474a56452c044a5facc877985ce0

See more details on using hashes here.

File details

Details for the file InPynamoDB-4.1.3-py3-none-any.whl.

File metadata

  • Download URL: InPynamoDB-4.1.3-py3-none-any.whl
  • Upload date:
  • Size: 60.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.6

File hashes

Hashes for InPynamoDB-4.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 58da32b0c3b95c9bffac309bfbf12c03819585a241bc767503a95c5bbf933838
MD5 50f4e0f9dd3fd0b57a5d38577254101d
BLAKE2b-256 9a97f5c1d745cb9ef5924cfe6a3029a636828090c59cdb9c0ae69de96afa0cef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page