Skip to content

Commit

Permalink
fix: query over edg
Browse files Browse the repository at this point in the history
  • Loading branch information
doctrino committed Nov 16, 2024
1 parent 05dd820 commit 76dc375
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 16 deletions.
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Changes are grouped as follows
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## TBD
### Fixed
- Doing `.query()` over an edge with properties without filtering no longer raises a `ValueError`.

## [0.99.48] - 24-11-14
### Fixed
- Add ability to filter on node external ID and space even when no other filterable properties are present.
Expand Down
4 changes: 2 additions & 2 deletions examples/cognite_core/data_classes/_core/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ def __getattr__(self, item: str) -> Any:
raise ValueError(f"Cannot query across a reverse-list connection.")
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{item}'")

def _assemble_filter(self) -> dm.filters.Filter:
def _assemble_filter(self) -> dm.filters.Filter | None:
filters: list[dm.filters.Filter] = [self._view_filter] if self._view_filter else []
for filter_cls in self._filter_classes:
if item := filter_cls._as_filter():
filters.append(item)
return dm.filters.And(*filters)
return dm.filters.And(*filters) if filters else None

def _repr_html_(self) -> str:
nodes = [step._result_cls.__name__ for step in self._creation_path]
Expand Down
4 changes: 2 additions & 2 deletions examples/equipment_unit/data_classes/_core/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ def __getattr__(self, item: str) -> Any:
raise ValueError(f"Cannot query across a reverse-list connection.")
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{item}'")

def _assemble_filter(self) -> dm.filters.Filter:
def _assemble_filter(self) -> dm.filters.Filter | None:
filters: list[dm.filters.Filter] = [self._view_filter] if self._view_filter else []
for filter_cls in self._filter_classes:
if item := filter_cls._as_filter():
filters.append(item)
return dm.filters.And(*filters)
return dm.filters.And(*filters) if filters else None

def _repr_html_(self) -> str:
nodes = [step._result_cls.__name__ for step in self._creation_path]
Expand Down
4 changes: 2 additions & 2 deletions examples/omni/data_classes/_core/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ def __getattr__(self, item: str) -> Any:
raise ValueError(f"Cannot query across a reverse-list connection.")
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{item}'")

def _assemble_filter(self) -> dm.filters.Filter:
def _assemble_filter(self) -> dm.filters.Filter | None:
filters: list[dm.filters.Filter] = [self._view_filter] if self._view_filter else []
for filter_cls in self._filter_classes:
if item := filter_cls._as_filter():
filters.append(item)
return dm.filters.And(*filters)
return dm.filters.And(*filters) if filters else None

def _repr_html_(self) -> str:
nodes = [step._result_cls.__name__ for step in self._creation_path]
Expand Down
4 changes: 2 additions & 2 deletions examples/omni_multi/data_classes/_core/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ def __getattr__(self, item: str) -> Any:
raise ValueError(f"Cannot query across a reverse-list connection.")
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{item}'")

def _assemble_filter(self) -> dm.filters.Filter:
def _assemble_filter(self) -> dm.filters.Filter | None:
filters: list[dm.filters.Filter] = [self._view_filter] if self._view_filter else []
for filter_cls in self._filter_classes:
if item := filter_cls._as_filter():
filters.append(item)
return dm.filters.And(*filters)
return dm.filters.And(*filters) if filters else None

def _repr_html_(self) -> str:
nodes = [step._result_cls.__name__ for step in self._creation_path]
Expand Down
4 changes: 2 additions & 2 deletions examples/omni_sub/data_classes/_core/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ def __getattr__(self, item: str) -> Any:
raise ValueError(f"Cannot query across a reverse-list connection.")
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{item}'")

def _assemble_filter(self) -> dm.filters.Filter:
def _assemble_filter(self) -> dm.filters.Filter | None:
filters: list[dm.filters.Filter] = [self._view_filter] if self._view_filter else []
for filter_cls in self._filter_classes:
if item := filter_cls._as_filter():
filters.append(item)
return dm.filters.And(*filters)
return dm.filters.And(*filters) if filters else None

def _repr_html_(self) -> str:
nodes = [step._result_cls.__name__ for step in self._creation_path]
Expand Down
4 changes: 2 additions & 2 deletions examples/scenario_instance/client/data_classes/_core/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ def __getattr__(self, item: str) -> Any:
raise ValueError(f"Cannot query across a reverse-list connection.")
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{item}'")

def _assemble_filter(self) -> dm.filters.Filter:
def _assemble_filter(self) -> dm.filters.Filter | None:
filters: list[dm.filters.Filter] = [self._view_filter] if self._view_filter else []
for filter_cls in self._filter_classes:
if item := filter_cls._as_filter():
filters.append(item)
return dm.filters.And(*filters)
return dm.filters.And(*filters) if filters else None

def _repr_html_(self) -> str:
nodes = [step._result_cls.__name__ for step in self._creation_path]
Expand Down
4 changes: 2 additions & 2 deletions examples/wind_turbine/data_classes/_core/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ def __getattr__(self, item: str) -> Any:
raise ValueError(f"Cannot query across a reverse-list connection.")
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{item}'")

def _assemble_filter(self) -> dm.filters.Filter:
def _assemble_filter(self) -> dm.filters.Filter | None:
filters: list[dm.filters.Filter] = [self._view_filter] if self._view_filter else []
for filter_cls in self._filter_classes:
if item := filter_cls._as_filter():
filters.append(item)
return dm.filters.And(*filters)
return dm.filters.And(*filters) if filters else None

def _repr_html_(self) -> str:
nodes = [step._result_cls.__name__ for step in self._creation_path]
Expand Down
4 changes: 2 additions & 2 deletions examples/windmill/data_classes/_core/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ def __getattr__(self, item: str) -> Any:
raise ValueError(f"Cannot query across a reverse-list connection.")
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{item}'")

def _assemble_filter(self) -> dm.filters.Filter:
def _assemble_filter(self) -> dm.filters.Filter | None:
filters: list[dm.filters.Filter] = [self._view_filter] if self._view_filter else []
for filter_cls in self._filter_classes:
if item := filter_cls._as_filter():
filters.append(item)
return dm.filters.And(*filters)
return dm.filters.And(*filters) if filters else None

def _repr_html_(self) -> str:
nodes = [step._result_cls.__name__ for step in self._creation_path]
Expand Down

0 comments on commit 76dc375

Please sign in to comment.