Skip to main content

Dynamodb Pretty Parser

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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dynamodb-prettyparser 1.0.1
File Size Uploaded
dynamodb-prettyparser-1.0.1.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dynamodb-prettyparser 1.0.1
File Interpreter ABI Platform
dynamodb_prettyparser-1.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 13.2 kB

Release files / dynamodb-prettyparser-1.0.1.tar.gz

Download URL dynamodb-prettyparser-1.0.1.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
05834c6050067148c30b5c93156988fc868922191a0aed3af8b3d1d32b4c2f47
BLAKE2b-256 checksum
How to use checksums
c9d5d98ee133f33d9ecf8710627e50769186c615c73698ae534147ff19267fe4
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/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8

Release files / dynamodb_prettyparser-1.0.1-py2.py3-none-any.whl

Download URL dynamodb_prettyparser-1.0.1-py2.py3-none-any.whl
Size 6.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a96ad416b975f4ae7feac313fe2d52ef98c38aa9097fc3c65afaaad434a11cb6
BLAKE2b-256 checksum
How to use checksums
b5961f2a72be69fa9a6a824f582994f56614a49127b8f817a783da08f9b4f117
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/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8

Release history Release notifications | RSS feed

1.0.4

2 release files

1.0.2

2 release files

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page