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
질문됨 한 달 전112회 조회
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
답변함 한 달 전
profile picture
전문가
검토됨 한 달 전
  • 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).

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠