industrial-model 0.1.34__tar.gz → 0.1.35__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {industrial_model-0.1.34 → industrial_model-0.1.35}/PKG-INFO +1 -1
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/models/base.py +11 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/models/entities.py +27 -2
- {industrial_model-0.1.34 → industrial_model-0.1.35}/pyproject.toml +1 -1
- {industrial_model-0.1.34 → industrial_model-0.1.35}/.gitignore +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/README.md +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/__init__.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/__init__.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/aggregation_mapper.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/filter_mapper.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/models.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/optimizer.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/query_mapper.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/query_result_mapper.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/search_mapper.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/sort_mapper.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/upsert_mapper.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/utils.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/view_mapper.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/config.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/constants.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/engines/__init__.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/engines/async_engine.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/engines/engine.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/models/__init__.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/models/schemas.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/py.typed +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/queries/__init__.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/queries/models.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/queries/params.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/queries/utils.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/statements/__init__.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/statements/expressions.py +0 -0
- {industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/utils.py +0 -0
|
@@ -55,3 +55,14 @@ class RootModel(BaseModel):
|
|
|
55
55
|
return key
|
|
56
56
|
|
|
57
57
|
return None
|
|
58
|
+
|
|
59
|
+
def get_field_alias(self, field_name_or_alias: str) -> str | None:
|
|
60
|
+
entry = self.__class__.model_fields.get(field_name_or_alias)
|
|
61
|
+
if entry:
|
|
62
|
+
return entry.alias
|
|
63
|
+
|
|
64
|
+
for _, field_info in self.__class__.model_fields.items():
|
|
65
|
+
if field_info.alias == field_name_or_alias:
|
|
66
|
+
return field_info.alias
|
|
67
|
+
|
|
68
|
+
return None
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from abc import abstractmethod
|
|
2
|
-
from datetime import date, datetime
|
|
2
|
+
from datetime import UTC, date, datetime
|
|
3
3
|
from typing import (
|
|
4
4
|
Any,
|
|
5
5
|
ClassVar,
|
|
@@ -9,7 +9,7 @@ from typing import (
|
|
|
9
9
|
TypeVar,
|
|
10
10
|
)
|
|
11
11
|
|
|
12
|
-
from pydantic import PrivateAttr
|
|
12
|
+
from pydantic import PrivateAttr, computed_field
|
|
13
13
|
|
|
14
14
|
from industrial_model.statements import Column
|
|
15
15
|
|
|
@@ -39,6 +39,18 @@ class EdgeContainer(InstanceId):
|
|
|
39
39
|
type: InstanceId
|
|
40
40
|
start_node: InstanceId
|
|
41
41
|
end_node: InstanceId
|
|
42
|
+
last_updated_time: int
|
|
43
|
+
created_time: int
|
|
44
|
+
|
|
45
|
+
@computed_field # type: ignore[prop-decorator]
|
|
46
|
+
@property
|
|
47
|
+
def created_time_as_datetime(self) -> datetime:
|
|
48
|
+
return datetime.fromtimestamp(self.created_time / 1000, tz=UTC)
|
|
49
|
+
|
|
50
|
+
@computed_field # type: ignore[prop-decorator]
|
|
51
|
+
@property
|
|
52
|
+
def last_updated_time_as_datetime(self) -> datetime:
|
|
53
|
+
return datetime.fromtimestamp(self.last_updated_time / 1000, tz=UTC)
|
|
42
54
|
|
|
43
55
|
|
|
44
56
|
TInstanceId = TypeVar("TInstanceId", bound=InstanceId)
|
|
@@ -60,6 +72,19 @@ class ViewInstance(InstanceId):
|
|
|
60
72
|
def get_view_external_id(cls) -> str:
|
|
61
73
|
return cls.view_config.get("view_external_id") or cls.__name__
|
|
62
74
|
|
|
75
|
+
def get_edge_metadata(self, property: Column | str | Any) -> list[EdgeContainer]:
|
|
76
|
+
assert isinstance(property, Column | str), (
|
|
77
|
+
f"Expected property to be Column, or str, got {type(property).__name__}"
|
|
78
|
+
)
|
|
79
|
+
identifier = property.property if isinstance(property, Column) else property
|
|
80
|
+
|
|
81
|
+
edge_map_key = self.get_field_alias(identifier) or self.get_field_name(
|
|
82
|
+
identifier
|
|
83
|
+
)
|
|
84
|
+
if not edge_map_key:
|
|
85
|
+
return []
|
|
86
|
+
return self._edges.get(edge_map_key, [])
|
|
87
|
+
|
|
63
88
|
def generate_model_id(
|
|
64
89
|
self,
|
|
65
90
|
fields: list[str] | list[Column] | list[Any],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/models.py
RENAMED
|
File without changes
|
{industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/optimizer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/sort_mapper.py
RENAMED
|
File without changes
|
|
File without changes
|
{industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/utils.py
RENAMED
|
File without changes
|
{industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/cognite_adapters/view_mapper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/engines/async_engine.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{industrial_model-0.1.34 → industrial_model-0.1.35}/industrial_model/statements/expressions.py
RENAMED
|
File without changes
|
|
File without changes
|