adverse-sapphire
adverse-sapphire•2y ago

Resource Primary Key

Is there a way to define the row which is used as primary key on any given resource? In some cases, we aren't using id as primary key and based on the API calls that the simple REST data source + AntDInferencer are firing off, the logic seems to assume that: 1) name (the actual pk) is a related entity 2) A resource's pk will always be id What if for example, I have something like placement.name as the pk? Is this something that's currently supported? Any suggestions on how to approach this scenario?
2 Replies
initial-rose
initial-rose•2y ago
Hey @_trashpile, Inferencer currently does not have this support but by copying the generated code and updating it, you can achieve this functionality by providing the value you want in id property of the hooks. I don't know the shape of your API but in addition you might need to customize your data provider to support that 🤔
adverse-sapphire
adverse-sapphire•2y ago
Got it! Thank you for the help. Will give this a try