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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76085a505d1620aaddea0ffdb30b4c5fc21b1c04765db4c39fb99fb6f6ccd0b9 |
|
MD5 | 69974d6b35fcbdb2cf6521e99436a123 |
|
BLAKE2b-256 | 49ebfef8c23088d5d3520c67d2ea3d1625b8c842363ba97fe13fa89ecea1128d |
Close
Hashes for cloudcomponents.cdk_dynamodb_seeder-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 575ca03d136fdf8f25da48d45f3e309a7a8e858aef8b08d4ce741977d32d0fbc |
|
MD5 | 3873c32a0bcd48e3c70b7c0f8b7d5cb0 |
|
BLAKE2b-256 | a19a20fee6a58f3d59b380551fad1e5718faad8a6ecba960dbc7026c4b3f2088 |