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
gefragt vor einem Monat113 Aufrufe
1 Antwort
0
Akzeptierte Antwort

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
beantwortet vor einem Monat
profile picture
EXPERTE
überprüft vor einem Monat
  • 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).

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen