{"id":16863410,"url":"https://github.com/bblommers/dynamodb-migrator","last_synced_at":"2025-04-11T08:58:22.530Z","repository":{"id":48191256,"uuid":"207992853","full_name":"bblommers/dynamodb-migrator","owner":"bblommers","description":"Tool that helps you create and migrate DynamoDB databases","archived":false,"fork":false,"pushed_at":"2021-11-01T11:11:50.000Z","size":86,"stargazers_count":4,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T06:24:14.811Z","etag":null,"topics":["aws","database","dynamodb","dynamodb-migrator","migration-tool","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/dynamodb-migrator/","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/bblommers.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-12T07:41:00.000Z","updated_at":"2022-09-07T21:52:03.000Z","dependencies_parsed_at":"2022-08-30T11:42:24.936Z","dependency_job_id":null,"html_url":"https://github.com/bblommers/dynamodb-migrator","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bblommers%2Fdynamodb-migrator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bblommers%2Fdynamodb-migrator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bblommers%2Fdynamodb-migrator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bblommers%2Fdynamodb-migrator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bblommers","download_url":"https://codeload.github.com/bblommers/dynamodb-migrator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248363589,"owners_count":21091393,"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":["aws","database","dynamodb","dynamodb-migrator","migration-tool","python"],"created_at":"2024-10-13T14:38:41.361Z","updated_at":"2025-04-11T08:58:22.506Z","avatar_url":"https://github.com/bblommers.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dynamodb-migrator \n[![Build Status](https://travis-ci.org/bblommers/dynamodb-migrator.svg?branch=master)](https://travis-ci.org/bblommers/dynamodb-migrator)\n[![Coverage Status](https://coveralls.io/repos/github/bblommers/dynamodb-migrator/badge.svg?branch=master)](https://coveralls.io/github/bblommers/dynamodb-migrator?branch=master)\n[![PyPI version](https://badge.fury.io/py/dynamodb-migrator.svg)](https://badge.fury.io/py/dynamodb-migrator)\n\nA library that helps you create and migrate DynamoDB databases.\n\nAs performant DynamoDB is, that does come with the trade-off of being inflexible. Changing column names or adding secondary indexes is impossible.  \nThe recommended approach is to create a new table with the desired properties, and migrate the existing data.  \nThis library will help  you do just that.\n  \n ## Usage\n - Write a migration script\n - Execute the migration script as a step in the build pipeline\n - Add to the migration-script as required\n \n## Example Script\n```python\nfrom migrator.dynamodb_migrator import Migrator\nmigrator = Migrator()\n@migrator.version(1)\n@migrator.create(AttributeDefinitions=[{'AttributeName': 'hash_key', 'AttributeType': 'N'}],\n                 TableName='my_new_table',\n                 KeySchema=[{'AttributeName': 'hash_key', 'KeyType': 'HASH'}],\n                 BillingMode='PAY_PER_REQUEST')\ndef v1(created_table):\n    print(\"Table created using the kwargs provided\")\n    print(\"Note that the keyword-args are passed onto boto as is\")\n    print(created_table)\n\n\n@migrator.version(2)\n@migrator.add_index(AttributeDefinitions=[{'AttributeName': 'postcode', 'AttributeType': 'S'}],\n                    LocalSecondaryIndexes=[{'IndexName': 'string',\n                                            'KeySchema': [{'AttributeName': 'customer_nr', 'KeyType': 'HASH'},\n                                                          {'AttributeName': 'postcode', 'KeyType': 'RANGE'}],\n                                            'Projection': {'ProjectionType': 'ALL'}}])\ndef v2(created_table):\n    print(\"Created a new table with the new index\")\n    print(\"Created a DynamoDB stream that sends all updates to the old table to a custom Lambda-function\")\n    print(\"The custom Lambda-function sends all updates to the new table\")\n    print(created_table)\n\n\n@NotYetImplemented\n@migrator.version(3)\n@migrator.delete_table(\"first_table\")\ndef v3(migrate):\n    print(\"About to delete table\")\n    print(\"Ensure that all upstream applications point to the new table, before adding this part to the pipeline!\")\n    migrate()\n    print(\"Table deleted\")\n\n\n@NotYetImplemented\n@migrator.version(4)\n@migrator.convert(lambda item -\u003e {'id': translate(item.id)})\ndef v4(migrate):\n    print(\"About to:\")\n    print(\" - Create new table (first_table_v4)\")\n    print(\" - Create a AWS Lambda script that will execute the above lambda, and write the result int he new table\")\n    print(\" - Create DynamoDB Stream on 'first_table' that triggers the new Lambda\")\n    print(\" - Execute a script that automatically updates all existing data\")\n    print(\"   (This will trigger all data in 'first_table' to be converted and copied into the new table\")\n    migrate()\n    print(\"Table with new data is ready to use\")\n\n```\n\n## Examples\nSee the [examples](examples)-folder.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbblommers%2Fdynamodb-migrator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbblommers%2Fdynamodb-migrator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbblommers%2Fdynamodb-migrator/lists"}