A seeder for dynamodb tables
Project description
@cloudcomponents/cdk-dynamodb-seeder
A seeder for dynamodb tables
Install
TypeScript/JavaScript:
npm i @cloudcomponents/cdk-dynamodb-seeder
Python:
pip install cloudcomponents.cdk-dynamodb-seeder
How to use
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
import path as path
from aws_cdk.core import Construct, Stack, StackProps, RemovalPolicy
from aws_cdk.aws_dynamodb import Table, AttributeType
from aws_cdk.aws_s3 import Bucket
from cloudcomponents.cdk_dynamodb_seeder import DynamoDBSeeder, Seeds
class DynamoDBSeederStack(Stack):
def __init__(self, scope, id, *, description=None, env=None, stackName=None, tags=None, synthesizer=None, terminationProtection=None):
super().__init__(scope, id, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection)
table = Table(self, "Table",
partition_key=Attribute(
name="id",
type=AttributeType.NUMBER
),
removal_policy=RemovalPolicy.DESTROY
)
DynamoDBSeeder(self, "JsonFileSeeder",
table=table,
seeds=Seeds.from_json_file(path.join(__dirname, "..", "seeds.json"))
)
DynamoDBSeeder(self, "InlineSeeder",
table=table,
seeds=Seeds.from_inline([{
"id": 3,
"column": "foo"
}, {
"id": 4,
"column": "bar"
}
])
)
seeds_bucket = Bucket.from_bucket_name(self, "SeedsBucket", "my-seeds-bucket")
DynamoDBSeeder(self, "BucketSeeder",
table=table,
seeds=Seeds.from_bucket(seeds_bucket, "seeds.json")
)
API Reference
See API.md.
Example
See more complete examples.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for cloudcomponents.cdk-dynamodb-seeder-1.0.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 527c787981bdae46b8a5da1727b32584ea0a610de3b8e6fb01a735d1a49def61 |
|
MD5 | ceeb764074e733b1582c4d974b112456 |
|
BLAKE2b-256 | 749b688777b506ac3bb53c9e08107a5b38ccbdb34b6b9c59a428a3aad6fcc5bf |
Close
Hashes for cloudcomponents.cdk_dynamodb_seeder-1.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 487c4f20cff7572b10dcb32aa0aa4fa9e9963f15fcb446a4b6c1b3ae7a8dbee2 |
|
MD5 | 29cc5539313ae56ca430f7630a3e46e0 |
|
BLAKE2b-256 | d187cdf1e6679bbef6d19b3cda9d6d52e92c43d3459fc6c4cfa685937888e076 |