Dynamodb Pretty Parser
THIS PACKAGE IS NOW PART OF the appsync-tools package Use it instead
https://github.com/QuiNovas/appsync-tools
Parses Dynamodb responses into a more usable format. Results are returned as a list of dictionaries with the attribute names being the key. Results are parsed recursively. One use is to return results directly to Appsync from a Lambda function. Parses all scalar types that Dynamo supports
N (number scalar) - cast as integer or Decimal types
S (string scalar) - stays string
SS (string set scalar) - list of strings
NS (number set scalar) - list of Decimal/integer
L (list scalar) - list
BOOL (boolean scalar) - boolean
B (binary scalar) - string of base64
BS (binary set scalar) - list of base64 strings
NULL (null scalar) - None
M (map scalar) - Dictionary
Responses are returned formated as:
[
{"attributeOneName": {"S": "value1"}, "attributeTwoName": {"S": "value2"}},
{"attributeOneName": {"S": "value1"}, "attributeTwoName": {"S": "value2"}}
]
Becomes
[
{"attributeOneName": "value1", "attributeTwoName": "value2"},
{"attributeOneName": "value1", "attributeTwoName": "value2"}
]
Where each dictionary in the top level array is a separate item.
Methods
parseResults(records) -> dict Arguments: items – Response from any boto3 call to Dynamodb that returns Items in the response
Example
from dynamodbPrettyParser import parseResults
import boto3
dynamodb = boto3.client('dynamodb')
response = dynamodb.query(
TableName='mytable',
KeyConditionExpression='my_attribute = :foo',
ExpressionAttributeValues={':foo': 'bar'}
)
print(parseResults(response))
Metadata
Release files for dynamodb-prettyparser 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dynamodb-prettyparser-1.0.4.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dynamodb_prettyparser-1.0.4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 14.2 kB
Release files / dynamodb-prettyparser-1.0.4.tar.gz
| Download URL | dynamodb-prettyparser-1.0.4.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f34b13940e4798704ffa3b5199d40d265a3a63521ca1b4a09bd41a83d6477c2e
|
|
BLAKE2b-256 checksum How to use checksums |
66e95c32f6436d4781f917b14a853ae4cb05f316ec91e350d53f4eb3d02b9e77
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.7.9
|
Release files / dynamodb_prettyparser-1.0.4-py2.py3-none-any.whl
| Download URL | dynamodb_prettyparser-1.0.4-py2.py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7df8a68a165c7aee8dc05768aca91d618e1121a6a6215d3e2a9dedd0881b9174
|
|
BLAKE2b-256 checksum How to use checksums |
dea8f63c2591ab3a683c5abd59e96066cab213e566fbf507a65c9f82b817d1ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.7.9
|