Skip to main content

Set of useful methods to speed up conversion of objects to AWS services

Project description

DynoDino

DynoDino is a set of useful methods to speed up the conversion of objects to AWS services, specifically DynamoDB. This library allows you to easily convert JSON data to DynamoDB format and vice versa.

Installation

To install the library, use pip:

pip install dyno-dino

Features

JSON to DynamoDB Conversion

The library provides methods to convert JSON data structures to the format accepted by DynamoDB. This includes converting common data types like strings, numbers, lists, and nested dictionaries.

Example Usage:

from dyno_dino import convert_json_to_dynamodb

json_data = {
    "name": "Victor",
    "phone": "5587975648710",
    "age": 30,
    "is_verified": True,
    "account_balance": 1234.56,
    "binary_data": "YWJjZGVmZ2g=",
    "nested_object": {
        "key1": "value1",
        "key2": 2
    },
    "list_data": ["item1", "item2", "item3"]
}

dynamodb_data = convert_json_to_dynamodb(json_data)
print(dynamodb_data)

DynamoDB to JSON Conversion

You can also convert data from DynamoDB format back to JSON, making it easier to manipulate and visualize the data.

Example Usage:

from dyno_dino import convert_dynamodb_to_json

dynamodb_data = {
    "M": {
        "name": {"S": "Victor"},
        "phone": {"S": "5587975648710"},
        "age": {"N": "30"},
        "is_verified": {"BOOL": True},
        "account_balance": {"N": "1234.56"},
        "binary_data": {"B": "YWJjZGVmZ2g="},
        "nested_object": {
            "M": {
                "key1": {"S": "value1"},
                "key2": {"N": "2"}
            }
        },
        "list_data": {"L": [
            {"S": "item1"},
            {"S": "item2"},
            {"S": "item3"}
        ]}
    }
}

json_data = convert_dynamodb_to_json(dynamodb_data)
print(json_data)

Available Methods

convert_json_to_dynamodb(data: dict) -> dict Converts a JSON dictionary to DynamoDB format.

  • Parameters:
    • data (dict): JSON dictionary to be converted.
  • Returns:
    • Dictionary in DynamoDB format.

convert_dynamodb_to_json(dynamodb_data: dict) -> dict Converts a DynamoDB format dictionary to JSON.

  • Parameters:
    • dynamodb_data (dict): DynamoDB format dictionary to be converted.
  • Returns:
    • JSON dictionary.

Contributing

Contributions are welcome! Feel free to open issues or pull requests on this GitHub repository.

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

dyno_dino-1.0.7.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

dyno_dino-1.0.7-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page