Skip to content
This repository was archived by the owner on Jun 19, 2023. It is now read-only.

Supporting operations for data upgradesΒ #113

Open
@aregier

Description

@aregier

First of all, thanks to the awslabs team for writing this library. It's been very helpful in producing high-quality micro-services that interact with dynamodb.

The methods createTable, ensureTableExists, deleteTable, and ensureTableNotExists have been helpful at continuous integration / deployment pipeline time, but now we are starting to run into use cases where we need to make small table changes such as adding a global secondary index.

The APIs on the server side do allow these kinds of table mutations, but they aren't surfaced through the DataMapper class. (see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#updateTable-property
and https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTable.html#DDB-UpdateTable-request-GlobalSecondaryIndexUpdates
).

One could easily see an interface like the following working well for allowing these small mutations:

ensureGlobalSecondaryIndexExists(valueConstructor: ZeroArgumentsConstructor<any>, options: CreateTableOptions, indexName: string)
createGlobalSecondaryIndex(valueConstructor: ZeroArgumentsConstructor<any>, options: CreateTableOptions, indexName: string)
updateGlobalSecondaryIndex(valueConstructor: ZeroArgumentsConstructor<any>, options: CreateTableOptions, indexName: string)
updateProvisionedThroughput(valueConstructor: ZeroArgumentsConstructor<any>, options: CreateTableOptions)
updateStreamSpecification(valueConstructor: ZeroArgumentsConstructor<any>, options: CreateTableOptions)

As a workaround, it would be really nice if the DataMapper class used protected as opposed to private so that the class could be extended as suggested.

One thing that might be difficult is getting a promise event-wait for the table to go from UPDATING state back into the ACTIVE state, as the waitFor method only has tableExists and tableNotExists at current.

thanks,
andrew

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestNew feature or enhancement. May require GitHub community feedback.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions