Double taxonomy modelling in DynamoDB

0

I'm working out a table schema in DynamoDB for a note taking app. What seems to be the problem is the double taxonomy the notes have. They may belong to notebooks and they also may be tagged.

For the matter let's assume there's single user of the app

I need both access patterns:

  1. Get all notes stored in a notebook
  2. Get all notes tagged by a tag

The basic way to store notes I see is use

  1. notebook ID as partition key
  2. note creation date as sort key

Is there a way to model tagged notes retrieval WITHOUT

  1. Duplicating notes essential content (title, body)
  2. Making the client do two sequential requests: to get notes IDs and then get tagged notes by BatchGetItem
tptm
已提問 1 個月前檢視次數 113 次
1 個回答
0
已接受的答案

Hi,

Based on the table design you have described, I don't think it is possible to do it all in 1 table or operation.

However, there are several patterns which you may want to study which may help you reimagine your table design approach for your overall app. Please take a look at the below:

https://aws.amazon.com/blogs/database/single-table-vs-multi-table-design-in-amazon-dynamodb/ https://www.alexdebrie.com/posts/dynamodb-one-to-many/ https://aws.amazon.com/blogs/database/model-hierarchical-automotive-component-data-using-amazon-dynamodb/

I hope this is helpful.

Thanks, Rama

profile pictureAWS
Rama
已回答 1 個月前
profile picture
專家
已審閱 1 個月前
  • Thank you for the fair answer Rama,

    Looks like double request is something that is being done in DynamoDB as needed. I found confirmation in how Alex DeBrie describes the fallback for many-to-many relationships modeling in Chapter 12.4 "Normalization and multiple requests" of "The DynamoDB Book" (https://www.dynamodbbook.com).

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南