3

I've been working with regular SQL databases and now wanted to start a new project using AWS services. I want the back end data storage to be DynamoDB and what I want to store is a tiered document, like an instruction booklet of all the programming tips I learned that can be pulled and called up via a React frontend.

So the data will be in a format like Python -> Classes -> General -> "Information on Classes Text Wall"

There will be more than one sub directory at times.

Future plans would be to be able to add new subfolders, move data to different folders, "thumbs up", and eventual multi account with read access to each other's data.

I know how to do this in a SQL DB, but have never used a NoSQL before and figured this would be a great starting spot.

I am also thinking of how to sort the partition, and I doubt this side program would ever grow to more than one cluster but I know with NoSQL you have to plan your layout ahead of time.

If NoSQL is just a horrible fit for this style of data, let me know as well. This is mostly for practice and to practice AWS systems.

NoSQLKnowHow
  • 4,449
  • 23
  • 35
  • 1
    This can certainly be done in a NoSQL database from what I am hearing. That said, if you are new to NoSQL databases, I would start by learning how and why they are or are not a good fit for workloads. You talk nothing of the access patterns you plan to solve for. In NoSQL, the best fit is when the data model you create pre-computes the answers to the questions your application will have. So your app is not asking question, but just getting the answers that are already in the DB because of the data model. Also, go watch this. https://www.youtube.com/watch?v=DIQVJqiSUkE – NoSQLKnowHow Jan 15 '20 at 22:58
  • 1
    Also, I recommend you go take this course. https://linuxacademy.com/course/dynamo-db-deep-dive/ It is completely free. Click on the 7 day free and then select the community free account. The course has excellent hands-on labs and great online lecture information. I highly recommend it. One thing to remember about NoSQL databases is that one of the worst things you can do with one is use it exactly like you did a relational database. – NoSQLKnowHow Jan 15 '20 at 23:03
  • Thank you so much for the info, I will definitely check out the course as I am looking for any way to practice DynamoDB and the other AWS Services that connect to it. – Karl Keisel Jan 16 '20 at 02:00

1 Answers1

1

DynamoDb is a key-value database with options to add a secondary indices. It's good to store documents that doesn't require full scan or aggregation queries. If you design your tiered document application to show only one document at a time, then DynamoDB would be a good choice. You can put the documents with a structure like this:

DocumentTable:
{
 "title": "Python",
 "parent_document": "root"
 "child_documents": ["Classes", "Built In", ...]
 "content": "text"
}

Where:

  • parent_document - the "title" of the parent document, may be empty for "Python" in your example for a document titled "Classes"
  • content - text or unstructured document with notes, thumbs up, etc, but you don't plan to execute conditional queries over it otherwise you need a global secondary index. But as you won't have many documents, full scan of a table won't take long.

You can also have another table with a table of contents for a user's tiered document, which you can use for easier navigate over the documents, however in this case you need to care about consistency of this table.

Example:

ContentsTable:
{
    "user": -- primary key for this table in case you have many users
    "root": [
        "Python":[
            "Classes": [
                "General": [
                    "Information on Classes Text Wall"
                ]
            ]
        ]
    ]
}

Where Python, Classes, General and Information on Classes Text Wall are keys for DocumentTable.title. You can also use something instead of titles to keep the keys unique. DynamoDB maximum document size is 400 KB, so this would be enough for a pretty large table of contents

Yann
  • 2,426
  • 1
  • 16
  • 33