Skip to main content

dynamodb (through boto3) with a simple (dict-like or list-like) interface

Project description

dynamodol

dynamodb (through boto3) with a simple (dict-like or list-like) interface

To install: pip install dynamodol

A basic DynamoDb via Boto3 persister demo:

>>> s = DynamoDbPersister()
>>> k = {'key': '777'} # Each collection will happily accept user-defined _key values.
>>> v = {'val': 'bar'}
>>> for _key in s:
...     del s[_key]
...
>>> k in s
False
>>> len(s)
0
>>> s[k] = v
>>> len(s)
1
>>> s[k]
{'val': 'bar'}
>>> s.get(k)
{'val': 'bar'}
>>> s.get({'not': 'a key'}, {'default': 'val'})  # testing s.get with default
{'default': 'val'}
>>> list(s.values())
[{'val': 'bar'}]
>>> k in s  # testing __contains__ again
True
>>> del s[k]
>>> len(s)
0
>>> s = DynamoDbPersister(table_name='dynamodol2', key_fields=('name',))
>>> for _key in s:
...   del s[_key]
>>> len(s)
0
>>> s[{'name': 'guido'}] = {'yob': 1956, 'proj': 'python', 'bdfl': False}
>>> s[{'name': 'guido'}]
{'proj': 'python', 'yob': Decimal('1956'), 'bdfl': False}
>>> s[{'name': 'vitalik'}] = {'yob': 1994, 'proj': 'ethereum', 'bdfl': True}
>>> s[{'name': 'vitalik'}]
{'proj': 'ethereum', 'yob': Decimal('1994'), 'bdfl': True}
>>> for key, val in s.items():
...   print(f"{key}: {val}")
{'name': 'vitalik'}: {'proj': 'ethereum', 'yob': Decimal('1994'), 'bdfl': True}
{'name': 'guido'}: {'proj': 'python', 'yob': Decimal('1956'), 'bdfl': False}

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

dynamodol-0.1.5.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

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

dynamodol-0.1.5-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file dynamodol-0.1.5.tar.gz.

File metadata

  • Download URL: dynamodol-0.1.5.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dynamodol-0.1.5.tar.gz
Algorithm Hash digest
SHA256 12d9b87c933dd9ec4e656be77dc937400ab36c05b6e8cc55870c55ad62497266
MD5 61a120d0144fd43c549098715d3eda2a
BLAKE2b-256 bfa4ef457776b7ea6f776e68720baa7a8a8a32572d91cb88e194211defea55f2

See more details on using hashes here.

File details

Details for the file dynamodol-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: dynamodol-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dynamodol-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f62b46a7219a662b053661cdb82cd405d8b81b789b404564d4720c2670450cde
MD5 c6a492122ee1f736897523114b4490bb
BLAKE2b-256 20dcc32f18a488481073b7c236589647e41c42000d9d2a0dee6596c626d6ede1

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