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.12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ef38c2980d1ff5eb4dea2cc2b0aa38f115316d2a3c8e249ea069c031781a022 |
|
MD5 | eb57b5323b58499410845b55fe55f528 |
|
BLAKE2b-256 | 6e8d6042e9ebd41405906908f4204ffd3295015a398b73cb1957663e47e5e28e |
Close
Hashes for cloudcomponents.cdk_dynamodb_seeder-1.0.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1af7fd6e9b631ed74532fd9725ef0074640bb0947fcdd0e715961921749d4d10 |
|
MD5 | ac93146272e90b6e777f70ad7ad64066 |
|
BLAKE2b-256 | 77dd921c903d88fb4d48a78f122450266c1e5f67af966a966d7a1b86484f8d55 |