Open dgarros opened 3 months ago
AFAIK you have to use populate_store=True
argument with prefetch_relationships=True
. It may not be explicitly called out in the documentation and maybe we should change that behavior?
dev = client.get(kind="InfraDevice", name__value="atl1-edge1", prefetch_relationships=True, populate_store=True)
dev.site.peer
Exact, prefetch_relationships
need populate_store
at the moment. We could consider "forcing" it if prefetch_relationships=True
We could consider "forcing" it if
prefetch_relationships=True
This makes a lot of sense to me.
I've also been confused by this in the past. I don't really like the way it currently works but depending on what we mean by "forcing" this sounds wrong to me. If we specify populate_store=False
as a user I wouldn't expect this to be overridden and done anyway behind the scenes. With the current function signature I think it would be better if we raised an error if someone tried to set prefetch_relationships=True
when populate_store was set to false.
IMO we could consider to set the default value for populate_store
to True
, but the user can still disable this behavior by setting it to False
when calling any of these methods?
IMO we could consider to set the default value for
populate_store
toTrue
, but the user can still disable this behavior by setting it toFalse
when calling any of these methods?
That works for me
Component
Python SDK
Infrahub version
0.15.1
Current Behavior
In the python SDK, when we are using the flag
prefetch_relationships
on a query (filters
,get
orall
) it's is still required to callfetch()
to access the related objectExpected Behavior
When using
prefetch_relationships
, it shouldn't be required to runfetch()
to access the related nodeSteps to Reproduce
Additional Information
No response