I am working with a dynamo db table that uses a gsi so I can query via an additional attribute, if it is present. This attribute will be updated in a process so all of the items do not have this attribute in the beginning of the process. This attribute is set as the primary key of the gsi, when added to the item.
Everything works as intended besides the fact that I cannot insert a new item without also specifying the primary key of the gsi. I want the gsi to ignore the item if its primary key is not set yet. I thought this would be possible with the option INCLUDE, when specifying the projected attributes. Obviously I am getting it wrong here but I also don't know how to solve this problem.
Any help is much appreciated and also I will have to stick to dynamo db so every hint including this db helps a lot!
EDIT: For clarification - these are my attributes:
- id (Primary Key: mandatory)
- name (Attribute)
- year (Attribute)
- gsi_id (GSI Primary Key: optional)
I want to add an item with the fields:
- id (Primary Key: mandatory)
- name (Attribute)
- year (Attribute)
and later add the gsi_id field.