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.15.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f3a6fc4e3e282074afd02aa4cf4b5ef44a4f3619ec78a036d7691e9c809bdd1 |
|
MD5 | d4f3ff488b0fcdd7234c2dce286fd577 |
|
BLAKE2b-256 | c7a548b719e63416fc3c7b10b7788259a88e4521ca72604b5d6e9752cabc3615 |
Close
Hashes for cloudcomponents.cdk_dynamodb_seeder-1.15.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 376f826215d169ff6b46616572c3dc6a7397cf9ad76c8d57413f8dcfa6dcb7e6 |
|
MD5 | d6a5b2533ae8a5a30cf096322b881344 |
|
BLAKE2b-256 | 42ac203922e7cccc4bc29a1b400e092d57ffc4cf14745ebc3c1f4a122d057cc0 |