ddb_exporter
ddb_exporter は、AWS DynamoDBのテーブル操作およびデータエクスポートを簡単に行うためのコマンドラインツールです。
インストール
ddb_exporter をインストールするには、以下のコマンドを実行してください:
pip install click boto3
次に、スクリプトファイルを実行可能にして、適切なディレクトリに配置します。
使い方
ddb_exporter コマンドは、AWSのDynamoDBサービスにアクセスして操作を行うためのサブコマンドを提供します。以下に各サブコマンドの詳細を示します。
共通オプション
--aws-profile(オプション): 使用するAWSプロファイル名。指定がない場合、デフォルトプロファイルまたは環境変数で設定された認証情報が使用されます。
サブコマンド
list-tables
指定したリージョンのDynamoDBテーブルを一覧表示します。
ddb_exporter list-tables --region <region> [--detail]
--region(オプション): AWSリージョン。デフォルトはus-east-1です。--detail(オプション): テーブルのスキーマ情報も含めて表示します。
export-table
指定したDynamoDBテーブルのデータをJSONファイルにエクスポートします。
ddb_exporter export-table --region <region> --table <table_name> [--output <output_file>] [--overwrite] [--partition-key <key>] [--sort-key <key>] [--sort-key-range <start,end>] [--index-name <index_name>] [--index-partition-key <key>] [--index-sort-key <key>]
--region(オプション): AWSリージョン。デフォルトはus-east-1です。--table(必須): エクスポートするDynamoDBテーブル名。--output(オプション): 出力先のJSONファイルパス。指定がない場合はテーブル名_タイムスタンプ.json形式で生成されます。--overwrite(オプション): 出力ファイルが既に存在する場合に上書きします。--partition-key(オプション): パーティションキーでデータをフィルタリングします。--sort-key(オプション): ソートキーでデータをフィルタリングします。--sort-key-range(オプション): ソートキーの範囲条件でデータをフィルタリングします(フォーマット:start,end)。--index-name(オプション): セカンダリインデックス名。--index-partition-key(オプション): セカンダリインデックスのパーティションキーでデータをフィルタリングします。--index-sort-key(オプション): セカンダリインデックスのソートキーでデータをフィルタリングします。
認証情報の設定
AWSの認証情報は、以下の方法で設定できます:
- AWS CLIでプロファイルを設定する。
aws configure --profile <profile_name>
- 環境変数を設定する。
export AWS_ACCESS_KEY_ID=<your_access_key_id> export AWS_SECRET_ACCESS_KEY=<your_secret_access_key> export AWS_SESSION_TOKEN=<your_session_token> # 必要な場合
エラー処理
認証情報が見つからない場合や認証に失敗した場合、以下のエラーメッセージが表示されます:
AWS credentials not found. Please configure your credentials or specify a profile.
また、DynamoDB操作に失敗した場合、適切なエラーメッセージが表示されます。
ライセンス
このプロジェクトはMITライセンスの下で公開されています。詳細については LICENSE ファイルを参照してください。
Metadata
Release files for ddb-exporter 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ddb_exporter-0.1.0.tar.gz | 4.6 kB | Without provenance | Details for ddb_exporter-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ddb_exporter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ddb_exporter-0.1.0-py3-none-any.whl |
Total release size: 9.8 kB
Release files / ddb_exporter-0.1.0.tar.gz
| Download URL | ddb_exporter-0.1.0.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63d36dd7ccdf4e97c15da39c101b249335ee7493e5fda9b01495ba8338c928da
|
|
BLAKE2b-256 checksum How to use checksums |
00a4ac8b561ea9108e5135edc2e8f4c60877c8d7e760285238852e62b7ff559f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.1 Windows/10
|
Release files / ddb_exporter-0.1.0-py3-none-any.whl
| Download URL | ddb_exporter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
21ef94d057cfbb4bcb65b44ed6d9133dc08e292aac57c54f006bdc72ee28472c
|
|
BLAKE2b-256 checksum How to use checksums |
6a7fa2fa2bdc27514ea602874763c506454123ffe9403856ad79b5e51d22a090
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.1 Windows/10
|
Security for ddb-exporter 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.