-
Notifications
You must be signed in to change notification settings - Fork 32
Update docs on list() and retrieve() to make it clearer to users how to get additional properties specified on views. #2180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…to get additional properties specified on views.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2180 +/- ##
==========================================
+ Coverage 90.65% 90.71% +0.05%
==========================================
Files 159 162 +3
Lines 24135 24372 +237
==========================================
+ Hits 21880 22109 +229
- Misses 2255 2263 +8
🚀 New features to boost your workflow:
|
|
||
Args: | ||
nodes (NodeId | Sequence[NodeId] | tuple[str, str] | Sequence[tuple[str, str]] | None): Node ids | ||
edges (EdgeId | Sequence[EdgeId] | tuple[str, str] | Sequence[tuple[str, str]] | None): Edge ids | ||
sources (Source | Sequence[Source] | None): Retrieve properties from the listed - by reference - views. | ||
sources (Source | Sequence[Source] | None): Governs which views to retrieve properties through. Only properties specified on the provided views will be retrieved. If not specified, only base properties (space, external id, type, ...) will be retrieved. Connection properties (edges and reverse direct properties, see https://docs.cognite.com/cdf/dm/dm_concepts/dm_containers_views_datamodels#connection-properties) can not be retrieved/traversed using this method; use the `query` method instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sources (Source | Sequence[Source] | None): Governs which views to retrieve properties through. Only properties specified on the provided views will be retrieved. If not specified, only base properties (space, external id, type, ...) will be retrieved. Connection properties (edges and reverse direct properties, see https://docs.cognite.com/cdf/dm/dm_concepts/dm_containers_views_datamodels#connection-properties) can not be retrieved/traversed using this method; use the `query` method instead. | |
sources (Source | Sequence[Source] | None): Governs which views to retrieve properties through. If not specified, only base properties (space, external id, type, ...) will be retrieved. `Connection properties <https://docs.cognite.com/cdf/dm/dm_concepts/dm_containers_views_datamodels#connection-properties>`_) cannot be retrieved/traversed using this method; use the `query` method instead. |
@@ -1612,7 +1612,7 @@ def list( | |||
Args: | |||
instance_type (Literal['node', 'edge'] | type[T_Node] | type[T_Edge]): Whether to query for nodes or edges. You can also pass a custom typed node (or edge class) inheriting from TypedNode (or TypedEdge). See apply, retrieve_nodes or retrieve_edges for an example. | |||
include_typing (bool): Whether to return property type information as part of the result. | |||
sources (Source | Sequence[Source] | None): Views to retrieve properties from. | |||
sources (Source | Sequence[Source] | None): Governs which views to retrieve properties through. Only properties specified on the provided views will be retrieved. If not specified, only base properties (space, external id, type, ...) will be retrieved. Connection properties (edges and reverse direct properties, see https://docs.cognite.com/cdf/dm/dm_concepts/dm_containers_views_datamodels#connection-properties) can not be retrieved/traversed using this method; use the `query` method instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sources (Source | Sequence[Source] | None): Governs which views to retrieve properties through. Only properties specified on the provided views will be retrieved. If not specified, only base properties (space, external id, type, ...) will be retrieved. Connection properties (edges and reverse direct properties, see https://docs.cognite.com/cdf/dm/dm_concepts/dm_containers_views_datamodels#connection-properties) can not be retrieved/traversed using this method; use the `query` method instead. | |
sources (Source | Sequence[Source] | None): Governs which views to retrieve properties through. If not specified, only base properties (space, external id, type, ...) will be retrieved. `Connection properties <https://docs.cognite.com/cdf/dm/dm_concepts/dm_containers_views_datamodels#connection-properties>`_) cannot be retrieved/traversed using this method; use the `query` method instead. |
Requesting input from @arnekv on exact wording here. |
As I mentioned on slack to @erlendvollset , the parts he's proposing to remove are parts that would have clarified the problem to newbies like me and Akshat. We sort of understood in principle that we'd only get the properties specified on the view, but actually saying that explicitly in the docs would have made it much clearer to both of us. Likewise, explicitly saying what kinds of properties are not returned (rather than making the user follow a link to a place where they're still not terribly explicit) is much more helpful to the uninitiated. |
…mples of connection properties. In fact, they're currently the only examples, but that could theoretically change.
…uld be used to retrieve ReverseDirectRelations, since there are multiple 'query' functions.
Description
Clear up confusion experienced by multiple newcomers to the API about how to retrieve properties specified on a view when using the list() and retrieve() methods in the cognite.client.data_classes.data_modeling.instances API.
There is one statement here that could use some assistance from someone who has a better understanding of what actually happens:
If not specified, only basic fields common to all instances will be retrieved
Any suggests for better wording would be welcome.
Checklist:
If a new method has been added it should be referenced in cognite.rst in order to generate docs based on its docstring.