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
preguntada hace un mes112 visualizaciones
1 Respuesta
0
Respuesta aceptada

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 hace un mes
profile picture
EXPERTO
revisado hace un mes
  • 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).

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas