Open ricky-sb opened 5 years ago
(This is offtopic, please remove if considered too derailing.)
Question: why use dynamo for relational data? The ridiculous read/write +scalability of dynamorm is somewhat moot if the architecture doesn't embrace uni-table design.
Note: I do know this is painful to read because I'm dealing with it in my own projects.
Uni-table design is difficult for me. I'd love for there to be a Pythonic way to manage single-table design.
Maybe something like:
And then, DynamORM automatically generates and manages compound keys, index overloading, adjacency lists, etc.
BTW, AWS's own AppSync uses multi-table design for DynamoDB relationships, even those guys have trouble automating single table design.
Those are definitely the sort of things that I'd expect an ORM to be responsible for. But it still feels like an ask to contort dynamo into something that it doesn't want to be.
Do you have a link to the AppSync architecture? I'd like to read more about their solution.
Check out this issue: https://github.com/aws-amplify/amplify-cli/issues/91
They use an intermediate join table. Scroll to the end and you'll see what I mean.
Some more relevant docs: https://aws-amplify.github.io/docs/cli-toolchain/graphql#connection https://aws-amplify.github.io/docs/cli-toolchain/graphql#data-access-patterns
Whoah. It looks like Amplify autogenerates a DynamoDB table for you based on a GQL schema? I've an auto table generator before for relational with Prisma but going through a NoSQL direction is new to me. Thanks for the links!
I would like to open discussions about implementing a ManyToMany feature.
From here:
I can provide this use-case if you'd like.
Although Amazon recommends an Adjacency List Pattern, I dislike how it makes the database almost completely unreadable.
Here's an interesting post which goes over potential approaches to ManyToMany in DynamoDB.
Can we discuss these approaches?
Using auxiliary tables:
And the fact that a lookup requires multiple requests over 3 tables... The fewer requests we can make to DynamoDB, the better it would be for performance.
Using sets:
Using transactions, we can ensure that updates are coordinated, and since we're doing this inside an ORM, the end-user doesn't need to worry about managing these calls directly. The real downside to this is the storage capacity on the attribute (400 KB). If our lists exceeds 400 KB, we can't add any more relationships.
Using adjacency lists:
This seems almost incompatible with current semantics. To properly spec out an adjacency list, you need to know your access patterns up front. There's no "pythonic" way to declare access patterns, so we'd need to build an entirely library just for that, and then convert that into an adjacency list.
Note: These guys have attempted it here