diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b922ef97..dbc5a772f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,11 @@ Changes are grouped as follows - `Fixed` for any bug fixes. - `Security` in case of vulnerabilities. +## [7.63.7] - 2024-10-18 +### Fixed +- Calling `cognite_client.data_modeling.instances(..., chunk_size=False, include_typing=False)` no longer raises a + `TypeError`. + ## [7.63.6] - 2024-10-17 ### Fixed - Files, or other resources with geo.location data, created long ago before the current API restriction(s) were in-place diff --git a/cognite/client/_api/data_modeling/instances.py b/cognite/client/_api/data_modeling/instances.py index f848aef1d..2ea2e0eb0 100644 --- a/cognite/client/_api/data_modeling/instances.py +++ b/cognite/client/_api/data_modeling/instances.py @@ -244,10 +244,10 @@ def __call__( ) if instance_type == "node": - resource_cls: type = _NodeOrEdgeResourceAdapter + resource_cls: type = Node list_cls: type = NodeList elif instance_type == "edge": - resource_cls, list_cls = _NodeOrEdgeResourceAdapter, EdgeList + resource_cls, list_cls = Edge, EdgeList else: raise ValueError(f"Invalid instance type: {instance_type}") if not include_typing: @@ -1564,12 +1564,12 @@ def list( ) if instance_type == "node": - resource_cls: type = _NodeOrEdgeResourceAdapter + resource_cls: type = Node list_cls: type = NodeList elif instance_type == "edge": - resource_cls, list_cls = _NodeOrEdgeResourceAdapter, EdgeList + resource_cls, list_cls = Edge, EdgeList elif inspect.isclass(instance_type) and issubclass(instance_type, TypedNode): - resource_cls = _NodeOrEdgeResourceAdapter + resource_cls = _NodeOrEdgeResourceAdapter(instance_type, Edge) # type: ignore[assignment] list_cls = _TypedNodeOrEdgeListAdapter(instance_type) # type: ignore[assignment] elif inspect.isclass(instance_type) and issubclass(instance_type, TypedEdge): resource_cls = _NodeOrEdgeResourceAdapter(Node, instance_type) # type: ignore[assignment] diff --git a/cognite/client/_version.py b/cognite/client/_version.py index 0a7cc03f1..3852fbf28 100644 --- a/cognite/client/_version.py +++ b/cognite/client/_version.py @@ -1,4 +1,4 @@ from __future__ import annotations -__version__ = "7.63.6" +__version__ = "7.63.7" __api_subversion__ = "20230101" diff --git a/pyproject.toml b/pyproject.toml index 32d8b1607..2f5c21d2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "cognite-sdk" -version = "7.63.6" +version = "7.63.7" description = "Cognite Python SDK" readme = "README.md" documentation = "https://cognite-sdk-python.readthedocs-hosted.com" diff --git a/tests/tests_integration/test_api/test_data_modeling/test_instances.py b/tests/tests_integration/test_api/test_data_modeling/test_instances.py index e34bc3d4f..e1af77e78 100644 --- a/tests/tests_integration/test_api/test_data_modeling/test_instances.py +++ b/tests/tests_integration/test_api/test_data_modeling/test_instances.py @@ -907,6 +907,13 @@ def test_list_in_units( assert type_.unit is not None assert type_.unit.external_id == "pressure:pa" + @pytest.mark.usefixtures("node_with_1_1_pressure_in_bar") + def test_iterate_one_by_one(self, cognite_client: CogniteClient, unit_view: View) -> None: + is_source = filters.HasData(views=[unit_view.as_id()]) + iterator = cognite_client.data_modeling.instances(filter=is_source, instance_type="node") + first_iter = next(iterator) + assert isinstance(first_iter, Node) + def test_iterate_in_units( self, cognite_client: CogniteClient, node_with_1_1_pressure_in_bar: NodeApply, unit_view: View ) -> None: