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, analyticsReporting=None):
super().__init__(scope, id, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting)
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.46.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c40dd0ba9db8cd53e93b69f2b02ded4463b398e0b45ab7f951a2c7c5859e0a2 |
|
MD5 | 9a30e38c71bfbf15092b10796f14d60e |
|
BLAKE2b-256 | 6353aca591bfb85259009f00ee1f8d65b10b73535c09f83fc7bf90b57b00a86c |
Close
Hashes for cloudcomponents.cdk_dynamodb_seeder-1.46.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b934440e9eb3fe0cedae51edda5d8e73621b99cf677af25f951ee9ec861b218a |
|
MD5 | e504e094c732d9b299323e804d590e6c |
|
BLAKE2b-256 | 532a6d4a5ef82f58252f968eac1df6c4677306f4811bf338aa3e85154a17277d |