Reputation: 159
For my secondary index, I would like to have a key column which is a semicolon separated data of 2 columns in the base table.
Is it possible to create a custom logic to generate such value for the key column in secondary index?
Upvotes: 0
Views: 34
Reputation: 8474
Unfortunately you can only use another key, verbatim- no transformations or custom logic.
If this is essential for you, however, you can enable DynamoDB streams on your table, and use them to trigger a lambda. The lambda could either:
I would probably lean towards the former, because then removal and synchronization of data is still DynamoDB's responsibility.
n.b. if you only need your key to be the two combined values, you could just use one as a partition and the other as a sort for your GSI.
Upvotes: 1