Anyone have a good example of using @dynamodb with a single table and multiple entities? Having a hard time finding a good example. Most sample apps don't seem to use one table as recommended by #AWS as best practice.
-
-
The part that is confusing to me is what you should one make the primary key of a top level entity (meaning no parent)? Do you just hard-code it in code? Children are easy since keys are derived largely from parent or are searchable.
-
Not sure I understand. Our lib did incrementing integers. Something like UUID prob makes more sense.
-
So let's say I need to load all users. If I make the partition key a guid, I am not sure I can search for all of the users without doing a full table scan (which is slow). I think for top level entities maybe you want to make partition key fixed
-
This is where you make a global secondary index on the sort key. So to get all users you query the secondary index for things that start with "user"
End of conversation
New conversation -
-
-
Say I wanted Users as a top level entity, the sort key could identify the individual user, but what is the partition key in that case? Do I hard-code it so I can query and page list of users? Otherwise how do I query top level stuff?
-
Obligatory note: You could just use CosmosDB where everything is indexed by default and this stuff is trivial :)
-
I wish I could use Cosmos or Firebase. We have a sweet heart deal with AWS due to how much traffic our main site gets. They give us great pricing on everything else so it's sort of a corporate standard to just use AWS for everything.
End of conversation
New conversation -
-
-
Those docs capture it, but need work. The gist is think of your single table as a list of edges. Nodes are just an edge that points to itself. All your relationships and indexes get jammed into your sort key.
-
Bustle had a lib that did something similar with two tables (nodes got their own table) https://github.com/bustle/dynamo-graph …. Not used anymore, but may be useful as a reference.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.