Skip to main content

Developer-friendly library for DynamoDB with single-table design, without ORM lock-in.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Dynamodx

A developer-friendly library for DynamoDB, simplifying single-table design without ORM lock-in.

from dynamodx.transact_writer import TransactWriter, TransactionOperationFailed

class EmailConflictError(TransactionOperationFailed):
    pass

try:
    with TransactWriter(table_name=..., client=...) as transact:
        transact.put(
            item={
                'pk': user_id,
                'sk': '0',
                'name': name,
                'email': email,
                'phone': phone,
            }
        )
        transact.put(
            item={
                'pk': f'EMAIL',
                'sk': email,
                'user_id': user_id,
            },
            cond_expr='attribute_not_exists(sk)',
            return_on_cond_fail='ALL_OLD',
            exc_cls=EmailConflictError,
        )
except EmailConflictError as err:
    # Got existing `user_id`
    user_id = err.reason['old_image']['user_id']

License

Dynamodx is open-source software licensed under the MIT License.

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

dynamodx-0.1.2.tar.gz (98.6 kB view details)

Uploaded Source

Built Distribution

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

dynamodx-0.1.2-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file dynamodx-0.1.2.tar.gz.

File metadata

  • Download URL: dynamodx-0.1.2.tar.gz
  • Upload date:
  • Size: 98.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for dynamodx-0.1.2.tar.gz
Algorithm Hash digest
SHA256 89e53d7bcc43cad28749d02baf6dfad6456ab1a52b56ee9d047519cacf70344d
MD5 7f8372af231de8756be0351efb9e6371
BLAKE2b-256 1c8646ea6df66b699a1f7424dbf8f71bf3ee82f42eb806d332c0f861659077ad

See more details on using hashes here.

File details

Details for the file dynamodx-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: dynamodx-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for dynamodx-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5527b8be01e24b0c1421c428669b86aeb18055d46fe5797738a6bfc1d0ad6fa3
MD5 6c35ec443656dec9547be72a77669dcd
BLAKE2b-256 5ead253bbd80c8b04ca3a8f4b0c7860d951af3085478739e161cb176df1ff762

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