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.1.tar.gz (97.0 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.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dynamodx-0.1.1.tar.gz
  • Upload date:
  • Size: 97.0 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.1.tar.gz
Algorithm Hash digest
SHA256 65358b9c4a323e03c1ced54b00e2e1b3662e43325c78572f3d7faff2b1ae9fa6
MD5 b0befc0fe87646d8c87de48b7410a675
BLAKE2b-256 2d8f3d55d796031b7f6633008b938c56e051389933a0d98dad1f113d9102565e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dynamodx-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3b10ecd62635d30c03a2e0a71dad4d58a30597c1e5759b5479adc1d61e759b24
MD5 5830e151139094eb96cc403812013cc6
BLAKE2b-256 47638685691e520c82d495fcf158bc0d57a0388a4d8af14bd103e9e1802d8533

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