Schema Design for DynamoDB with Variable Sort Keys
I'm looking for a bit of guidance on something.
I'm trying to create a dynamodb schema to match an existing one that already exists. I've got a couple of indexes that end up getting used in different ways depending on the type of object being stored, and I'm trying to figure out a good way to model that in schema. For instance, in one type, the sort_key is a constant, we'll call it 'X' for the time being, and in another it's 'Y-<uuid>'. I can think of a couple of ways to do this, but I'm looking for experience here.
My first thought is to have a union of possible options for the sort_key value.
This seems like it is going to get hard quite quickly as I add more and more of what is going on with the repository.
The other option I can think of is to have a base class, and then override it:
Has anyone had to deal with a situation like this and had better luck with a particular approach?
I'm trying to create a dynamodb schema to match an existing one that already exists. I've got a couple of indexes that end up getting used in different ways depending on the type of object being stored, and I'm trying to figure out a good way to model that in schema. For instance, in one type, the sort_key is a constant, we'll call it 'X' for the time being, and in another it's 'Y-<uuid>'. I can think of a couple of ways to do this, but I'm looking for experience here.
My first thought is to have a union of possible options for the sort_key value.
This seems like it is going to get hard quite quickly as I add more and more of what is going on with the repository.
The other option I can think of is to have a base class, and then override it:
Has anyone had to deal with a situation like this and had better luck with a particular approach?
