Add location_parent_parent_name etc support#502
Add location_parent_parent_name etc support#502cdtomkins wants to merge 18 commits intonautobot:developfrom
Conversation
DistantVoyager
left a comment
There was a problem hiding this comment.
@cdtomkins take a look at my suggestions. I have not tested, but please do and see if that (or something similar) will handle n number of location_parents from a CSV
Co-authored-by: Steven Weiblinger <111259311+DistantVoyager@users.noreply.github.com>
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
|
@Dav-C @scetron Last week we discussed two possibilities for this one:
Personally I think (1) is the right path and align it with next major version. Thoughts appreciated. If you agree (1) I'll get the UTs finished up. |
|
Hello, |
Yes I agree it should close #399. This patch is working fine, I just need to write some tests and then I should be able to merge. I hope to do so this week. If you have a development environment, feel free to test there in the meantime. |
|
@Dav-C made a good recommendation to make this more performant by avoiding repeat lookups where a row's location ancestry has already been checked by adding a cache. Will action this before merge. |
Closes #399
What's Changed
Replaces the previous single-parent lookup logic with a dynamic ancestry traversal that supports arbitrary depth in the location hierarchy.
Before
location_nameplus an optionallocation_parent_namewere validAfter
_get_location_by_dynamic_ancestry()method discovers alllocation_parent*columns in the CSV row, orders them by depth, and walks the hierarchy from root to immediate parent before resolving the target Location.To Do