Skip to main content

Python command line interface for copying/querying/restoring DynamoDB tables and items.

Project description

Dynamo CLI

Python Command-line interface to copy Dynamodb data in parallel batch processing + query natural & Global Secondary Indexes (GSIs).

Author: Simon Ryu

Pre-requisite

  • Profiles in .aws/credentials are configured for AWS environments (accounts).
  • Install dynamo-cmdline package: pip install dynamo-cmdline

Running the CLI

Help message

Displays a help message for using the CLI.

$ dynamo -h

Command line interface to copy, query and restore DynamoDB tables and items

positional arguments:
  {copy,restore,query}
    copy                Copy table or items from source to target envrionment
    query               Query items in specified environment's table

optional arguments:
  -h, --help            show this help message and exit

Copy table

Creates an on-demand target table backup, truncates all items in the target table and copies all source table items in its place.

$ dynamo copy --table foo --source production --target development

Copy foo table from production to development environment.

Copy items

Copies queried items from source table to target table. Queries items in source and target table, deletes them from the target table, then copies queried source items to the target table. For querying with sort keys, the comparision condition is begins_with.

$ dynamo copy --table foo --pk pkexample#id --sk skexample#id --source development --target test

Copy queried items in its natural table from development to test environment.

$ dynamo copy --table foo --pk pkexample#id --index example-index --source prod --target stage

Copy queried items in the table's secondary index from production to staging environment.

Query

Query items in specified environment's table.

$ dynamo query --table foo pkexample#id --env dev --head

Prints the number of items queried as well as the first item returned from the query.

$ dynamo query --table foo pkexample#id --env dev --unique entity-type

Prints the number of items queried as well as the unique attribute values of the specified field. Atrribute value must be str.

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

dynamo-cmdline-0.0.1.tar.gz (8.5 kB view details)

Uploaded Source

File details

Details for the file dynamo-cmdline-0.0.1.tar.gz.

File metadata

  • Download URL: dynamo-cmdline-0.0.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for dynamo-cmdline-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b1c8d86977dc3a39757841a15f91869c4d2643edf96cf753008da5b307d456c4
MD5 714e0cc71f1169477147b54b078fe2fe
BLAKE2b-256 d649f6bb250766524f994f028f48f91fa58444166e490c05cf70ed4f2d949033

See more details on using hashes here.

Supported by

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