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
feita há um mês112 visualizações
1 Resposta
0
Resposta aceita

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
respondido há um mês
profile picture
ESPECIALISTA
avaliado há um mês
  • 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).

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas