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.33.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c611fe6d63141e3451fe52f36d311d3bbc24aa28186a0d1fd2723384d111acc8 |
|
MD5 | bff9fb708c01bbeaa0a1de16148a19ea |
|
BLAKE2b-256 | 78e00c65d8a2ce816406aaa8078f6f80f145a1a7e53d1d842f5d41f7e4ba1259 |
Close
Hashes for cloudcomponents.cdk_dynamodb_seeder-1.33.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8abc0d4cc413121753e82a2801d2ed51bff74a99558aae30af6965b04defc4ec |
|
MD5 | 9d2dcb585a56e97c604cdb92c8302c65 |
|
BLAKE2b-256 | 36f4a6279c76c103dd73679da0c1f89c66b8f48c054980ff7384cd03c993a63c |