Skip to main content

Parses dynamodb responses into a list dictionaries with attribute names as keys

Project description

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"}}


  {"attributeOneName": "value1", "attributeTwoName": "value2"},
  {"attributeOneName": "value1", "attributeTwoName": "value2"}

Where each dictionary in the top level array is a separate item.


parseResults(records) -> dict Arguments: items – Response from any boto3 call to Dynamodb that returns Items in the response


from dynamodbPrettyParser import parseResults
import boto3

dynamodb = boto3.client('dynamodb')
response = dynamodb.query(
  KeyConditionExpression='my_attribute = :foo',
  ExpressionAttributeValues={':foo': 'bar'}


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for dynamodb-prettyparser, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size dynamodb_prettyparser-1.0.0-py2.py3-none-any.whl (6.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size dynamodb-prettyparser-1.0.0.tar.gz (6.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page