dynamodb-ce
Installation
pip install dynamodb-ce
Overview
dynamodb-ce is a compiler that can compile DynamoDB Conditional Expressions into executable Python truthy functions that evaluate either a Python dict or a DynamoDB item (with DynamoDB typing).
Setting up the parser requires setting expression attribute names and values, just as they would be set when calling DynamoDB. Expression attribute values can be represented either using Python types or DynamoDB types.
Compilation is done once per (expression, attribute names, attribute values) tuple and cached. The truthy function that is the result of the compilation is designed to be extremely fast.
Lexing and parsing courtesy of SLY.
Usage
Using DynamoDB types:
from dynamodb_ce import CeParser
parser = CeParser(
expression_attribute_names={"#path": "body"},
expression_attribute_values={':string1': {'S': "a"}, ':string2': {'S': "b"}, ':number1': {'N': 1}, ':number2': {'N': 2}}
)
item = {"body": {"M": {"number1": {"N": 1}, "number2": {"N": 2}, "string1": {"S": "a"}, "string2": {"S": "b"}}}}
parser.evaluate("#path.string2 > #path.string1", item)
Using Python types
from dynamodb_ce import CeParser
parser = CeParser(
expression_attribute_names={"#path": "body"},
expression_attribute_values={':string1': "a", ':string2': "b", ':number1': 1, ':number2': 2}
)
item = {"body": {"number1": 1, "number2": 2, "string1": "a", "string2": "b"}}
parser.evaluate("#path.string2 > #path.string1", item)
Using the parsed (compiled) result directly
from dynamodb_ce import CeParser
parser = CeParser(
expression_attribute_names={"#path": "body"},
expression_attribute_values={':string1': "a", ':string2': "b", ':number1': 1, ':number2': 2}
)
item = {"body": {"number1": 1, "number2": 2, "string1": "a", "string2": "b"}}
truthy = parser.parse("#path.string2 > #path.string1")
truthy(item)
Metadata
Release files for dynamodb-ce 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dynamodb-ce-0.0.5.tar.gz | 8.6 kB | Without provenance | Details for dynamodb-ce-0.0.5.tar.gz |
Release files / dynamodb-ce-0.0.5.tar.gz
| Download URL | dynamodb-ce-0.0.5.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e6464208ca7f12bfede5e76950ec7fb417867c4a23e71018a03b6cc45c26b0f
|
|
BLAKE2b-256 checksum How to use checksums |
42a613f8054caf68bef149643569407aa7d6e09fa372fc3eb69328e9a0ba468d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.11
|
Security for dynamodb-ce 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.