Allow a parent reference in the identifiers
Kircheneer opened this issue · 4 comments
Environment
- DiffSync version: 1.7.1
Proposed Functionality
The _identifiers
of a model should allow a reference to the parent's set of _identifiers
.
Use Case
Taking a simple building -> floor parent-child hierarchy the 2nd floor only needs to be unique within its own building. Currently I have to do a workaround like this:
class Floor(DiffSyncModel):
_identifiers = ("name", "building_name")
name: str
building_name: str
when I would much rather want to do something like this
class Floor(DiffSyncModel):
_identifiers = ("name", "$parent")
name: str
to make my floors unique where BuildingModel
looks like this:
class Building(DiffSyncModel):
_identifiers = ("name")
_children = {"floor": "floors"}
name: str
floors: List[Floor] = []
I guess this assumes this, doesn't it?:
class Building(DiffSyncModel):
_identifiers = ("name")
_children = {"floor": "floors"}
name: str
floors: List = []
I guess this assumes this, doesn't it?:
Yes, thanks. Updated.
I presume you are already referencing this, but in case not: https://github.com/nautobot/nautobot-plugin-ssot/pull/69/files#diff-d5a05dc0fa5ec399d2b02a105d518741cfc140ec6ce19c4694a3e8c1b8f3e9a7R98
I presume you are already referencing this, but in case not: https://github.com/nautobot/nautobot-plugin-ssot/pull/69/files#diff-d5a05dc0fa5ec399d2b02a105d518741cfc140ec6ce19c4694a3e8c1b8f3e9a7R98
Actually I am not, thanks! From what you linked I can't quite tell in which section you need this, but I think I get the general idea.