2 ms·
> This got me thinking about DynamoDB (a database I use day to day, and for which I maintain dynaglue, a single-table mapping layer for TypeScript/JavaScript),
by joshstrange 4y ago
> This got me thinking about DynamoDB (a database I use day to day, and for which I maintain dynaglue, a single-table mapping layer for TypeScript/JavaScript), and made me wonder if a DynamoDB adapter existed.
I hadn't seen dynaglue when I went looking recently for a TypeScript library for DynamoDB. I played around with a couple of options out there and ended up settling on TypeDORM. Overall I'm happy with it. I find it a little odd that so few TypeScript/DynamoDB wrappers support fetching multiple entities in a single call (Example: PK is userId, SK is userId for the User entity, and SK is addressId for the user's addresses, get user and all their addresses in a single call by only querying with the shared PK). I guess I understand why, you'd need to be hydrating the objects returned from DynamoDB into classes (and thus storing something on the Items in DynamoDB that hint you the class to hydrate into) and it can be weird to get back an array of mixed class instances. In the end I just query for 1 entity at a time or a group of children entities for a given parent and I'm pretty happy overall.
If you want learn more about Single Table Design with DynamoDB then you should absolutely check out the book: https://www.dynamodbbook.com/ https://www.dynamodbbook.com/ -- I was skeptical as I'm not really a programming book type of guy but this was an amazing resource for how to think about Single Table Design and how to structure your data. There is a hacker news coupon "HACKERNEWS" for $20 off that I found in an old thread and it still works.