{"id":13512573,"url":"https://github.com/dineshsonachalam/lucid-dynamodb","last_synced_at":"2026-04-10T05:04:05.275Z","repository":{"id":44597945,"uuid":"65635235","full_name":"dineshsonachalam/lucid-dynamodb","owner":"dineshsonachalam","description":"🗄️ A simple Python wrapper to AWS Dynamodb.","archived":false,"fork":false,"pushed_at":"2024-01-02T17:44:29.000Z","size":668,"stargazers_count":110,"open_issues_count":4,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-03-18T13:08:46.262Z","etag":null,"topics":["automation","boto3","dynamodb","python3"],"latest_commit_sha":null,"homepage":"https://lucid-dynamodb.dineshsonachalam.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dineshsonachalam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-08-13T20:17:55.000Z","updated_at":"2024-01-13T17:26:22.000Z","dependencies_parsed_at":"2024-01-01T19:28:55.721Z","dependency_job_id":"fa0c4a06-4aff-4e53-84c3-3265449231a7","html_url":"https://github.com/dineshsonachalam/lucid-dynamodb","commit_stats":{"total_commits":237,"total_committers":4,"mean_commits":59.25,"dds":"0.11814345991561181","last_synced_commit":"1e7145b14f1f462e2d8fe320b46b3820967bbcbf"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshsonachalam%2Flucid-dynamodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshsonachalam%2Flucid-dynamodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshsonachalam%2Flucid-dynamodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshsonachalam%2Flucid-dynamodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dineshsonachalam","download_url":"https://codeload.github.com/dineshsonachalam/lucid-dynamodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246399816,"owners_count":20770907,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","boto3","dynamodb","python3"],"created_at":"2024-08-01T04:00:21.071Z","updated_at":"2025-12-14T20:04:38.509Z","avatar_url":"https://github.com/dineshsonachalam.png","language":"Python","funding_links":[],"categories":["Python","Tools","Open Source Repos"],"sub_categories":["DynamoDB"],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003ca href=\"https://pypi.org/project/LucidDynamodb\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://i.imgur.com/r9hHHUo.png\" alt=\"LucidDynamodb\"\u003e\n  \u003c/a\u003e\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n    \u003cem\u003eA minimalistic wrapper to \u003ca href=\"https://aws.amazon.com/dynamodb\"\u003eAWS DynamoDB\u003c/a\u003e\u003c/em\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://sonarcloud.io/dashboard?id=lucid-dynamodb\"\u003e\n        \u003cimg src=\"https://sonarcloud.io/api/project_badges/quality_gate?project=lucid-dynamodb\"/\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.codacy.com/gh/dineshsonachalam/lucid-dynamodb/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=dineshsonachalam/lucid-dynamodb\u0026amp;utm_campaign=Badge_Grade\"\u003e\n        \u003cimg src=\"https://app.codacy.com/project/badge/Grade/3607dfd408bb4b7394cb0631b717a76e\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://snyk.io/test/github/dineshsonachalam/lucid-dynamodb\"\u003e\n        \u003cimg src=\"https://snyk.io/test/github/dineshsonachalam/lucid-dynamodb/badge.svg\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/dineshsonachalam/Lucid-Dynamodb/actions\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://github.com/dineshsonachalam/Lucid-Dynamodb/actions/workflows/pypi-deploy.yml/badge.svg\" alt=\"Deployment\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/LucidDynamodb\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://img.shields.io/pypi/v/LucidDynamodb?color=%2334D058\u0026label=pypi%20package\" alt=\"Package version\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/dineshsonachalam/Lucid-Dynamodb/blob/master/LICENSE\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://badgen.net/github/license/dineshsonachalam/Lucid-Dynamodb\" alt=\"MIT License\" height=\"20\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nUseful links:\n- See the full documentation at https://lucid-dynamodb.dineshsonachalam.com\n- Ask questions in the \u003ca href =\"https://github.com/dineshsonachalam/lucid-dynamodb/issues\"\u003eGitHub issues\u003c/a\u003e\n\n## Table of contents\n- [Installation](#installation)\n- [Example](#example)\n    - [Connect to DynamodDB](#connect-to-dynamodb)\n    - [Create a new table](#create-a-new-table)\n    - [Get all table names](#get-all-table-names)\n    - [Create a New Item](#create-a-new-item)\n    - [Read an Item](#read-an-item)\n    - [Read items by filter](#read-items-by-filter)\n    - [Update existing attribute in an item](#update-existing-attribute-in-an-item)\n    - [Add a new attribute in an item](#add-a-new-attribute-in-an-item)\n    - [Add an attribute to the list](#add-an-attribute-to-the-list)\n    - [Add an attribute to the string set](#add-an-attribute-to-the-string-set)\n    - [Increase an existing attribute value](#increase-an-existing-attribute-value)\n    - [Delete an attribute from an item](#delete-an-attribute-from-an-item)\n    - [Delete an attribute from the string set](#delete-an-attribute-from-the-string-set)\n    - [Delete an item](#delete-an-item)\n    - [Delete a table](#delete-a-table)\n- [Running tests](#running-tests)\n- [Github Workflow Artifacts](#github-workflow-artifacts)\n- [License](#license)\n\n## Installation\n\u003cdiv class=\"termy\"\u003e\n\n```console\npip install LucidDynamodb\n```\n  \n\u003c/div\u003e\n\n**Note:**  \u003ca href=\"https://gist.github.com/dineshsonachalam/88f55b28c1f0c1ce93421f5a8f33e84a\"\u003e Prerequisite for Python3 development \u003c/a\u003e\n\n## Example\n\n#### Connect to DynamoDB\nYou can connect to DynamoDB by following any of these two ways.\n\n1. Using AWS config\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/using-aws-config-to-connect-to-dynamodb.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/using-aws-config-to-connect-to-dynamodb.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\ndb = DynamoDb()\n\n\"\"\"\n$ pip install awscli  #can add user flag\n$ aws configure\nAWS Access Key ID [****************ABCD]:[enter your key here]\nAWS Secret Access Key [****************xyz]:[enter your secret key here]\nDefault region name [us-west-2]:[enter your region here]\nDefault output format [None]:\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n2. Using AWS secret key\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/using-aws-secret-to-connect-to-dynamodb.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/using-aws-secret-to-connect-to-dynamodb.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nimport os\nAWS_ACCESS_KEY_ID = os.getenv(\"AWS_ACCESS_KEY_ID\")\nAWS_SECRET_ACCESS_KEY = os.getenv(\"AWS_SECRET_ACCESS_KEY\")\ndb = DynamoDb(region_name=\"us-east-1\",\n              aws_access_key_id=AWS_ACCESS_KEY_ID,\n              aws_secret_access_key=AWS_SECRET_ACCESS_KEY)\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n#### Create a new table\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/1-create-a-new-table.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/1-create-a-new-table.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nfrom LucidDynamodb.exceptions import (\n    TableAlreadyExists\n)\nimport logging\nlogging.basicConfig(level=logging.INFO)\n\ntable_schema = {\n\t\"TableName\": \"dev_jobs\",\n\t\"KeySchema\": [{\n\t\t\t\"AttributeName\": \"company_name\",\n\t\t\t\"KeyType\": \"HASH\"\n\t\t},\n\t\t{\n\t\t\t\"AttributeName\": \"role_id\",\n\t\t\t\"KeyType\": \"RANGE\"\n\t\t}\n\t],\n\t\"AttributeDefinitions\": [{\n\t\t\t\"AttributeName\": \"company_name\",\n\t\t\t\"AttributeType\": \"S\"\n\t\t},\n\t\t{\n\t\t\t\"AttributeName\": \"role_id\",\n\t\t\t\"AttributeType\": \"S\"\n\t\t}\n\t],\n\t\"GlobalSecondaryIndexes\": [],\n\t\"ProvisionedThroughput\": {\n\t\t\"ReadCapacityUnits\": 1,\n\t\t\"WriteCapacityUnits\": 1\n\t}\n}\n\nif __name__ == \"__main__\":\n    try:\n        db = DynamoDb()\n        db.create_table(\n            table_name=table_schema.get(\"TableName\"),\n            key_schema=table_schema.get(\"KeySchema\"),\n            attribute_definitions=table_schema.get(\"AttributeDefinitions\"),\n            global_secondary_indexes=table_schema.get(\"GlobalSecondaryIndexes\"),\n            provisioned_throughput=table_schema.get(\"ProvisionedThroughput\")\n        )\n        logging.info(f\"{table_schema.get('TableName')} table created successfully\")\n    except TableAlreadyExists as e:\n        logging.error(f\"{table_schema.get('TableName')} table creation failed - {e}\")\n\n\"\"\"\ndineshsonachalam@macbook examples % python 1-create-a-new-table.py\nINFO:botocore.credentials:Found credentials in environment variables.\nINFO:root:dev_jobs table created successfully\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n#### Get all table names\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/2-get-all-table-names.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/2-get-all-table-names.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nfrom LucidDynamodb.exceptions import (\n    UnexpectedError\n)\nimport logging\nlogging.basicConfig(level=logging.INFO)\n\nif __name__ == \"__main__\":\n    try:\n        db = DynamoDb()\n        table_names = db.read_all_table_names()\n        logging.info(f\"Table names: {table_names}\")\n    except UnexpectedError as e:\n        logging.error(f\"Read all table names failed - {e}\")\n\n\"\"\"\ndineshsonachalam@macbook examples % python 2-get-all-table-names.py\nINFO:botocore.credentials:Found credentials in environment variables.\nINFO:root:Table names: ['CertMagic', 'dev_jobs', 'dev_test', 'kp-config-v1', 'test-1']\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n#### Create a new item\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/3-create-a-new-item.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/3-create-a-new-item.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nfrom LucidDynamodb.exceptions import (\n    UnexpectedError\n)\nimport logging\nlogging.basicConfig(level=logging.INFO)\n\nif __name__ == \"__main__\":\n    try:\n        db = DynamoDb()\n        db.create_item(\n            table_name=\"dev_jobs\",\n            item={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\",\n                \"role\": \"Software Engineer 1\",\n                \"salary\": \"$1,50,531\",\n                \"locations\": [\"Mountain View, California\", \"Austin, Texas\", \"Chicago, IL\"],\n                \"yearly_hike_percent\": 8,\n                \"benefits\": set([\"Internet, Medical, Edu reimbursements\",\n                                \"Health insurance\",\n                                \"Travel reimbursements\"\n                                ]),\n                \"overall_review\":{\n                    \"overall_rating\" : \"4/5\",\n                    \"compensation_and_benefits\": \"3.9/5\"\n                }\n            }\n        )\n        logging.info(\"Item created successfully\")\n    except UnexpectedError as e:\n        logging.error(f\"Item creation failed - {e}\")\n        \n\"\"\"\ndineshsonachalam@macbook examples % python 3-create-a-new-item.py\nINFO:botocore.credentials:Found credentials in environment variables.\nINFO:root:Item created successfully\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n#### Read an item\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/4-read-an-item.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/4-read-an-item.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nfrom LucidDynamodb.exceptions import (\n    ItemNotFound\n)\nimport logging\nlogging.basicConfig(level=logging.INFO)\n\nif __name__ == \"__main__\":\n    try:\n        db = DynamoDb()\n        item = db.read_item(\n            table_name=\"dev_jobs\",\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            }\n        )\n        logging.info(f\"Item: {item}\")\n    except ItemNotFound as e:\n        logging.error(f\"Item doesn't exist - {e}\")\n        \n\"\"\"\ndineshsonachalam@macbook examples % python 4-read-an-item.py\nINFO:botocore.credentials:Found credentials in environment variables.\nINFO:root:Item: {\n\t'locations': ['Mountain View, California', 'Austin, Texas', 'Chicago, IL'],\n\t'role_id': '111',\n\t'overall_review': {\n\t\t'compensation_and_benefits': '3.9/5',\n\t\t'overall_rating': '4/5'\n\t},\n\t'company_name': 'Google',\n\t'role': 'Software Engineer 1',\n\t'yearly_hike_percent': Decimal('8'),\n\t'salary': '$1,50,531',\n\t'benefits': {\n\t\t'Travel reimbursements',\n\t\t'Internet, Medical, Edu reimbursements',\n\t\t'Health insurance'\n\t}\n}\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n#### Read items by filter\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/5-read-items-by-filter.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/5-read-items-by-filter.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nfrom LucidDynamodb.exceptions import (\n    QueryFilterValidationFailed\n)\nimport logging\nfrom boto3.dynamodb.conditions import Key\nlogging.basicConfig(level=logging.INFO)\n\nif __name__ == \"__main__\":\n    try:\n        db = DynamoDb()\n        db.create_item(\n            table_name=\"dev_jobs\",\n            item={\n                \"company_name\": \"Google\",\n                \"role_id\": \"112\",\n                \"role\": \"Software Architect\",\n                \"salary\": \"$4,80,000\",\n                \"locations\": [\"Mountain View, California\"],\n                \"yearly_hike_percent\": 13,\n                \"benefits\": set([\"Internet reimbursements\"]),\n                \"overall_review\":{\n                    \"overall_rating\" : \"3/5\",\n                    \"compensation_and_benefits\": \"4.2/5\"\n                }\n            }\n        )\n        logging.info(\"Item created successfully\")\n        items = db.read_items_by_filter(\n                        table_name='dev_jobs',\n                        key_condition_expression=Key(\"company_name\").eq(\"Google\")\n        )\n        logging.info(f\"Items: {items}\")\n    except QueryFilterValidationFailed as e:\n        logging.error(f\"Items doesn't exist - {e}\")\n\n\"\"\"\ndineshsonachalam@macbook examples % python 5-read-items-by-filter.py\nINFO:botocore.credentials:Found credentials in environment variables.\nINFO:root:Item created successfully\nINFO:root:Items: [{\n\t'locations': ['Mountain View, California', 'Austin, Texas', 'Chicago, IL'],\n\t'role_id': '111',\n\t'overall_review': {\n\t\t'compensation_and_benefits': '3.9/5',\n\t\t'overall_rating': '4/5'\n\t},\n\t'company_name': 'Google',\n\t'role': 'Software Engineer 1',\n\t'yearly_hike_percent': Decimal('8'),\n\t'salary': '$1,50,531',\n\t'benefits': {\n\t\t'Internet, Medical, Edu reimbursements',\n\t\t'Travel reimbursements',\n\t\t'Health insurance'\n\t}\n}, {\n\t'locations': ['Mountain View, California'],\n\t'role_id': '112',\n\t'overall_review': {\n\t\t'compensation_and_benefits': '4.2/5',\n\t\t'overall_rating': '3/5'\n\t},\n\t'company_name': 'Google',\n\t'role': 'Software Architect',\n\t'yearly_hike_percent': Decimal('13'),\n\t'salary': '$4,80,000',\n\t'benefits': {\n\t\t'Internet reimbursements'\n\t}\n}]\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n#### Update existing attribute in an item\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/6-update-existing-attribute-in-an-item.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/6-update-existing-attribute-in-an-item.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nfrom LucidDynamodb.exceptions import (\n    UnexpectedError\n)\nimport logging\nlogging.basicConfig(level=logging.INFO)\n\nif __name__ == \"__main__\":\n    try:\n        db = DynamoDb()\n        db.update_item(\n            table_name=\"dev_jobs\",\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            },\n            attributes_to_update={\n                'role': 'Staff Software Engineer 2'\n            }\n        )\n        logging.info(\"Update is successful\")\n        item = db.read_item(\n            table_name=\"dev_jobs\",\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            }\n        )\n        logging.info(f\"Item: {item}\")\n    except UnexpectedError as e:\n        logging.error(f\"Update failed - {e}\")\n\n\"\"\"\ndineshsonachalam@macbook examples % python 6-update-existing-attribute-in-an-item.py\nINFO:botocore.credentials:Found credentials in environment variables.\nINFO:root:Update is successful\nINFO:root:Item: {\n\t'locations': ['Mountain View, California', 'Austin, Texas', 'Chicago, IL'],\n\t'role_id': '111',\n\t'overall_review': {\n\t\t'compensation_and_benefits': '3.9/5',\n\t\t'overall_rating': '4/5'\n\t},\n\t'company_name': 'Google',\n\t'role': 'Staff Software Engineer 2',\n\t'yearly_hike_percent': Decimal('8'),\n\t'salary': '$1,50,531',\n\t'benefits': {\n\t\t'Health insurance',\n\t\t'Internet, Medical, Edu reimbursements',\n\t\t'Travel reimbursements'\n\t}\n}\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n#### Add a new attribute in an item\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/7-add-a-new-attribute-in-an-item.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/7-add-a-new-attribute-in-an-item.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nfrom LucidDynamodb.exceptions import (\n    UnexpectedError\n)\nimport logging\nlogging.basicConfig(level=logging.INFO)\n\nif __name__ == \"__main__\":\n    try:\n        db = DynamoDb()\n        db.update_item(\n            table_name=\"dev_jobs\",\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            },\n            attributes_to_update={\n                'overall_review.yearly_bonus_percent': 12\n            }\n        )\n        logging.info(\"Update is successful\")\n        item = db.read_item(\n            table_name=\"dev_jobs\",\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            }\n        )\n        logging.info(f\"Item: {item}\")\n    except UnexpectedError as e:\n        logging.error(f\"Update failed - {e}\")\n\n\"\"\"\ndineshsonachalam@macbook examples % python 7-add-a-new-attribute-in-an-item.py\nINFO:botocore.credentials:Found credentials in environment variables.\nINFO:root:Update is successful\nINFO:root:Item: {\n\t'locations': ['Mountain View, California', 'Austin, Texas', 'Chicago, IL'],\n\t'role_id': '111',\n\t'overall_review': {\n\t\t'compensation_and_benefits': '3.9/5',\n\t\t'overall_rating': '4/5',\n\t\t'yearly_bonus_percent': Decimal('12')\n\t},\n\t'company_name': 'Google',\n\t'role': 'Staff Software Engineer 2',\n\t'yearly_hike_percent': Decimal('8'),\n\t'salary': '$1,50,531',\n\t'benefits': {\n\t\t'Travel reimbursements',\n\t\t'Internet, Medical, Edu reimbursements',\n\t\t'Health insurance'\n\t}\n}\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n#### Add an attribute to the list\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/8-add-an-attribute-to-the-list.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/8-add-an-attribute-to-the-list.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nfrom LucidDynamodb.exceptions import (\n    UnexpectedError\n)\nimport logging\nlogging.basicConfig(level=logging.INFO)\n\nif __name__ == \"__main__\":\n    try:\n        db = DynamoDb()\n        db.update_item(\n            table_name=\"dev_jobs\",\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            },\n            attributes_to_update={\n                'locations': \"Detroit, Michigan\"\n            },\n            operation=\"ADD_ATTRIBUTE_TO_LIST\"\n        )\n        logging.info(\"Update is successful\")\n        item = db.read_item(\n            table_name=\"dev_jobs\",\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            }\n        )\n        logging.info(f\"Item: {item}\")\n    except UnexpectedError as e:\n        logging.error(f\"Update failed - {e}\")\n\n\"\"\"\ndineshsonachalam@macbook examples % python 8-add-an-attribute-to-the-list.py\nINFO:botocore.credentials:Found credentials in environment variables.\nINFO:root:Update is successful\nINFO:root:Item: {\n\t'locations': ['Mountain View, California', 'Austin, Texas', 'Chicago, IL', 'Detroit, Michigan'],\n\t'role_id': '111',\n\t'overall_review': {\n\t\t'compensation_and_benefits': '3.9/5',\n\t\t'overall_rating': '4/5',\n\t\t'yearly_bonus_percent': Decimal('12')\n\t},\n\t'company_name': 'Google',\n\t'role': 'Staff Software Engineer 2',\n\t'yearly_hike_percent': Decimal('8'),\n\t'salary': '$1,50,531',\n\t'benefits': {\n\t\t'Health insurance',\n\t\t'Travel reimbursements',\n\t\t'Internet, Medical, Edu reimbursements'\n\t}\n}\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n#### Add an attribute to the string set\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/9-add-an-attribute-to-the-string-set.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/9-add-an-attribute-to-the-string-set.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nfrom LucidDynamodb.exceptions import (\n    UnexpectedError\n)\nimport logging\nlogging.basicConfig(level=logging.INFO)\n\nif __name__ == \"__main__\":\n    try:\n        db = DynamoDb()\n        db.update_item(\n            table_name=\"dev_jobs\",\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            },\n            attributes_to_update={\n                'benefits': \"Free Food\"\n            },\n            operation=\"ADD_ATTRIBUTE_TO_STRING_SET\"\n        )\n        logging.info(\"Update is successful\")\n        item = db.read_item(\n            table_name=\"dev_jobs\",\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            }\n        )\n        logging.info(f\"Item: {item}\")\n    except UnexpectedError as e:\n        logging.error(f\"Update failed - {e}\")\n\n\"\"\"\ndineshsonachalam@macbook examples % python 9-add-an-attribute-to-the-string-set.py\nINFO:botocore.credentials:Found credentials in environment variables.\nINFO:root:Update is successful\nINFO:root:Item: {\n\t'locations': ['Mountain View, California', 'Austin, Texas', 'Chicago, IL', 'Detroit, Michigan'],\n\t'role_id': '111',\n\t'overall_review': {\n\t\t'compensation_and_benefits': '3.9/5',\n\t\t'overall_rating': '4/5',\n\t\t'yearly_bonus_percent': Decimal('12')\n\t},\n\t'company_name': 'Google',\n\t'role': 'Staff Software Engineer 2',\n\t'yearly_hike_percent': Decimal('8'),\n\t'salary': '$1,50,531',\n\t'benefits': {\n\t\t'Travel reimbursements',\n\t\t'Free Food',\n\t\t'Health insurance',\n\t\t'Internet, Medical, Edu reimbursements'\n\t}\n}\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n#### Increase an existing attribute value\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/10-increase-an-existing-attribute-value.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/10-increase-an-existing-attribute-value.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nfrom LucidDynamodb.exceptions import (\n    UnexpectedError\n)\nimport logging\nlogging.basicConfig(level=logging.INFO)\n\nif __name__ == \"__main__\":\n    try:\n        db = DynamoDb()\n        db.increase_attribute_value(\n            table_name='dev_jobs',\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            },\n            attribute_name=\"yearly_hike_percent\",\n            increment_value=5\n        )\n        logging.info(\"Attribute value increment completed\")\n        item = db.read_item(\n            table_name='dev_jobs',\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            }\n        )\n        logging.info(f\"Item: {item}\")\n    except UnexpectedError as e:\n        logging.error(f\"Attribute value increment failed - {e}\")\n\n\"\"\"\ndineshsonachalam@macbook examples % python 10-increase-an-existing-attribute-value.py\nINFO:botocore.credentials:Found credentials in environment variables.\nINFO:root:Attribute value increment completed\nINFO:root:Item: {\n\t'locations': ['Mountain View, California', 'Austin, Texas', 'Chicago, IL', 'Detroit, Michigan'],\n\t'role_id': '111',\n\t'overall_review': {\n\t\t'compensation_and_benefits': '3.9/5',\n\t\t'overall_rating': '4/5',\n\t\t'yearly_bonus_percent': Decimal('12')\n\t},\n\t'company_name': 'Google',\n\t'role': 'Staff Software Engineer 2',\n\t'yearly_hike_percent': Decimal('13'),\n\t'salary': '$1,50,531',\n\t'benefits': {\n\t\t'Internet, Medical, Edu reimbursements',\n\t\t'Free Food',\n\t\t'Health insurance',\n\t\t'Travel reimbursements'\n\t}\n}\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n#### Delete an attribute from an item\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/11-delete-an-attribute-from-an-item.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/11-delete-an-attribute-from-an-item.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nfrom LucidDynamodb.exceptions import (\n    UnexpectedError\n)\nimport logging\nlogging.basicConfig(level=logging.INFO)\n\nif __name__ == \"__main__\":\n    try:\n        db = DynamoDb()\n        db.delete_attribute(\n            table_name=\"dev_jobs\",\n            key={\"company_name\": \"Google\", \"role_id\": \"111\"},\n            attribute_name=\"yearly_hike_percent\")\n        logging.info(\"The attribute is deleted successfully\")\n        item = db.read_item(\n            table_name=\"dev_jobs\",\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            }\n        )\n        logging.info(f\"Item: {item}\")\n    except UnexpectedError as e:\n         logging.error(f\"The attribute delete operation failed - {e}\")\n\n\"\"\"\ndineshsonachalam@macbook examples % python 11-delete-an-attribute-from-an-item.py\nINFO:botocore.credentials:Found credentials in environment variables.\nINFO:root:The attribute is deleted successfully\nINFO:root:Item: {\n\t'locations': ['Mountain View, California', 'Austin, Texas', 'Chicago, IL', 'Detroit, Michigan'],\n\t'role_id': '111',\n\t'overall_review': {\n\t\t'compensation_and_benefits': '3.9/5',\n\t\t'overall_rating': '4/5',\n\t\t'yearly_bonus_percent': Decimal('12')\n\t},\n\t'company_name': 'Google',\n\t'role': 'Staff Software Engineer 2',\n\t'salary': '$1,50,531',\n\t'benefits': {\n\t\t'Travel reimbursements',\n\t\t'Free Food',\n\t\t'Health insurance',\n\t\t'Internet, Medical, Edu reimbursements'\n\t}\n}\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n#### Delete an attribute from the string set\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/12-delete-an-attribute-from-the-string-set.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/12-delete-an-attribute-from-the-string-set.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nfrom LucidDynamodb.exceptions import (\n    UnexpectedError\n)\nimport logging\nlogging.basicConfig(level=logging.INFO)\n\nif __name__ == \"__main__\":\n    try:\n        db = DynamoDb()\n        db.update_item(\n            table_name=\"dev_jobs\",\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            },\n            attributes_to_update={\n                'benefits': \"Free Food\"\n            },\n            operation=\"DELETE_ATTRIBUTE_FROM_STRING_SET\"\n        )\n        logging.info(\"Update is successful\")\n        item = db.read_item(\n            table_name=\"dev_jobs\",\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            }\n        )\n        logging.info(f\"Item: {item}\")\n    except UnexpectedError as e:\n        logging.error(f\"Update failed - {e}\")\n\n\"\"\"\ndineshsonachalam@macbook examples % python 12-delete-an-attribute-from-the-string-set.py\nINFO:botocore.credentials:Found credentials in environment variables.\nINFO:root:Update is successful\nINFO:root:Item: {\n\t'locations': ['Mountain View, California', 'Austin, Texas', 'Chicago, IL', 'Detroit, Michigan'],\n\t'role_id': '111',\n\t'overall_review': {\n\t\t'compensation_and_benefits': '3.9/5',\n\t\t'overall_rating': '4/5',\n\t\t'yearly_bonus_percent': Decimal('12')\n\t},\n\t'company_name': 'Google',\n\t'role': 'Staff Software Engineer 2',\n\t'salary': '$1,50,531',\n\t'benefits': {\n\t\t'Internet, Medical, Edu reimbursements',\n\t\t'Health insurance',\n\t\t'Travel reimbursements'\n\t}\n}\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n#### Delete an item\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/13-delete-an-item.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/13-delete-an-item.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nfrom LucidDynamodb.exceptions import (\n    UnexpectedError\n)\nfrom boto3.dynamodb.conditions import Key\nimport logging\nlogging.basicConfig(level=logging.INFO)\n\nif __name__ == \"__main__\":\n    try:\n        db = DynamoDb()\n        db.delete_item(\n            table_name=\"dev_jobs\",\n            key={\n                \"company_name\": \"Google\",\n                \"role_id\": \"111\"\n            }\n        )\n        logging.info(\"Item deleted successfully\")\n        items = db.read_items_by_filter(\n                        table_name='dev_jobs',\n                        key_condition_expression=Key(\"company_name\").eq(\"Google\")\n        )\n        logging.info(f\"Items: {items}\") \n    except UnexpectedError as e:\n        logging.warning(f\"Item delete operation failed - {e}\")\n        \n\"\"\"\ndineshsonachalam@macbook examples % python 13-delete-an-item.py\nINFO:botocore.credentials:Found credentials in environment variables.\nINFO:root:Item deleted successfully\nINFO:root:Items: [{\n\t'locations': ['Mountain View, California'],\n\t'role_id': '112',\n\t'overall_review': {\n\t\t'compensation_and_benefits': '4.2/5',\n\t\t'overall_rating': '3/5'\n\t},\n\t'company_name': 'Google',\n\t'role': 'Software Architect',\n\t'yearly_hike_percent': Decimal('13'),\n\t'salary': '$4,80,000',\n\t'benefits': {\n\t\t'Internet reimbursements'\n\t}\n}]\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n#### Delete a table\n\u003c!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./examples/14-delete-a-table.py) --\u003e\n\u003c!-- The below code snippet is automatically added from ./examples/14-delete-a-table.py --\u003e\n```py\nfrom LucidDynamodb import DynamoDb\nfrom LucidDynamodb.exceptions import (\n    TableNotFound\n)\nimport logging\nlogging.basicConfig(level=logging.INFO)\n\nif __name__ == \"__main__\":\n    try:\n        db = DynamoDb()\n        db.delete_table(table_name='dev_jobs')\n        logging.info(\"Table deleted successfully\")\n        table_names = db.read_all_table_names()\n        logging.info(f\"Table names: {table_names}\")\n    except TableNotFound as e:\n        logging.error(f\"Table delete operation failed {e}\")\n\n\"\"\"\ndineshsonachalam@macbook examples % python 14-delete-a-table.py\nINFO:botocore.credentials:Found credentials in environment variables.\nINFO:root:Table deleted successfully\nINFO:root:Table names: ['CertMagic', 'dev_test', 'kp-config-v1', 'test-1']\n\"\"\"\n```\n\u003c!-- MARKDOWN-AUTO-DOCS:END --\u003e\n\n## Running Tests\n\nTo run tests, run the following command\n\n```bash\npytest -s\n```\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/) © [dineshsonachalam](https://www.github.com/dineshsonachalam)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdineshsonachalam%2Flucid-dynamodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdineshsonachalam%2Flucid-dynamodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdineshsonachalam%2Flucid-dynamodb/lists"}