industrial-model 0.1.19__tar.gz → 0.1.21__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.
Files changed (47) hide show
  1. {industrial_model-0.1.19 → industrial_model-0.1.21}/PKG-INFO +1 -1
  2. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/cognite_adapters/utils.py +4 -4
  3. {industrial_model-0.1.19 → industrial_model-0.1.21}/pyproject.toml +1 -1
  4. industrial_model-0.1.21/scripts/build.sh +4 -0
  5. industrial_model-0.1.21/scripts/publish.sh +2 -0
  6. industrial_model-0.1.21/tests/test_schema.py +352 -0
  7. {industrial_model-0.1.19 → industrial_model-0.1.21}/uv.lock +1 -1
  8. industrial_model-0.1.19/scripts/build.sh +0 -1
  9. {industrial_model-0.1.19 → industrial_model-0.1.21}/.gitignore +0 -0
  10. {industrial_model-0.1.19 → industrial_model-0.1.21}/.python-version +0 -0
  11. {industrial_model-0.1.19 → industrial_model-0.1.21}/README.md +0 -0
  12. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/__init__.py +0 -0
  13. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/cognite_adapters/__init__.py +0 -0
  14. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/cognite_adapters/aggregation_mapper.py +0 -0
  15. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/cognite_adapters/filter_mapper.py +0 -0
  16. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/cognite_adapters/models.py +0 -0
  17. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/cognite_adapters/optimizer.py +0 -0
  18. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/cognite_adapters/query_mapper.py +0 -0
  19. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/cognite_adapters/query_result_mapper.py +0 -0
  20. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/cognite_adapters/sort_mapper.py +0 -0
  21. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/cognite_adapters/upsert_mapper.py +0 -0
  22. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/cognite_adapters/view_mapper.py +0 -0
  23. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/config.py +0 -0
  24. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/constants.py +0 -0
  25. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/engines/__init__.py +0 -0
  26. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/engines/async_engine.py +0 -0
  27. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/engines/engine.py +0 -0
  28. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/models/__init__.py +0 -0
  29. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/models/base.py +0 -0
  30. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/models/entities.py +0 -0
  31. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/models/schemas.py +0 -0
  32. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/py.typed +0 -0
  33. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/queries/__init__.py +0 -0
  34. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/queries/models.py +0 -0
  35. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/queries/params.py +0 -0
  36. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/statements/__init__.py +0 -0
  37. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/statements/expressions.py +0 -0
  38. {industrial_model-0.1.19 → industrial_model-0.1.21}/industrial_model/utils.py +0 -0
  39. {industrial_model-0.1.19 → industrial_model-0.1.21}/scripts/format.sh +0 -0
  40. {industrial_model-0.1.19 → industrial_model-0.1.21}/scripts/lint.sh +0 -0
  41. {industrial_model-0.1.19 → industrial_model-0.1.21}/tests/__init__.py +0 -0
  42. {industrial_model-0.1.19 → industrial_model-0.1.21}/tests/cognite-sdk-config.yaml +0 -0
  43. {industrial_model-0.1.19 → industrial_model-0.1.21}/tests/hubs.py +0 -0
  44. {industrial_model-0.1.19 → industrial_model-0.1.21}/tests/models.py +0 -0
  45. {industrial_model-0.1.19 → industrial_model-0.1.21}/tests/tests_adapter.py +0 -0
  46. {industrial_model-0.1.19 → industrial_model-0.1.21}/tests/tests_aggregate.py +0 -0
  47. /industrial_model-0.1.19/tests/test_upsert_mapper.py → /industrial_model-0.1.21/tests/tests_upsert_mapper.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: industrial-model
3
- Version: 0.1.19
3
+ Version: 0.1.21
4
4
  Summary: Industrial Model ORM
5
5
  Author-email: Lucas Alves <lucasrosaalves@gmail.com>
6
6
  Classifier: Programming Language :: Python
@@ -109,8 +109,8 @@ def _create_query(
109
109
  final_cursors: dict[str, str | None] = {}
110
110
 
111
111
  for cursor_key, cursor_value in leaf_cursors.items():
112
- children = nodes_children[cursor_key]
113
- parent = nodes_parent[cursor_key]
112
+ children = nodes_children.get(cursor_key, set())
113
+ parent = nodes_parent.get(cursor_key, set())
114
114
 
115
115
  valid_keys = parent.union(children)
116
116
  valid_keys.add(cursor_key)
@@ -145,13 +145,13 @@ def _get_leaf_cursors(
145
145
  ):
146
146
  continue
147
147
 
148
- children = nodes_children[cursor_key]
148
+ children = nodes_children.get(cursor_key, set())
149
149
 
150
150
  target_cursors_keys = target_cursors.keys()
151
151
  if len(children.intersection(target_cursors_keys)) > 0:
152
152
  continue
153
153
 
154
- parent = nodes_parent[cursor_key]
154
+ parent = nodes_parent.get(cursor_key, set())
155
155
  cursor_to_remove = parent.intersection(target_cursors_keys)
156
156
  for cursor_key_to_remove in cursor_to_remove:
157
157
  target_cursors.pop(cursor_key_to_remove)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "industrial-model"
3
- version = "0.1.19"
3
+ version = "0.1.21"
4
4
  description = "Industrial Model ORM"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -0,0 +1,4 @@
1
+ sh ./scripts/lint.sh
2
+ rm -rf dist
3
+ uv sync
4
+ uv build
@@ -0,0 +1,2 @@
1
+ sh ./scripts/build.sh
2
+ uv publish
@@ -0,0 +1,352 @@
1
+ from pydantic import BaseModel
2
+
3
+ from industrial_model.models import get_schema_properties
4
+ from tests.models import (
5
+ DescribableEntity,
6
+ Event,
7
+ EventDetail,
8
+ Msdp,
9
+ ReportingSite,
10
+ WritableEvent,
11
+ )
12
+
13
+ SEP = "|"
14
+
15
+
16
+ class _Car(BaseModel):
17
+ model: str
18
+ year: int
19
+ owner: "SuperNestedModel"
20
+ previous_owners: list["SuperNestedModel"] | None
21
+
22
+
23
+ class SuperNestedModel(DescribableEntity):
24
+ parent: "SuperNestedModel"
25
+ children: list["SuperNestedModel"]
26
+ cars: list[_Car] | None
27
+
28
+
29
+ def test_get_schema_properties() -> None:
30
+ for entity, expected_schema in _get_test_schema().items():
31
+ schema = get_schema_properties(entity, SEP)
32
+ assert schema == expected_schema, (
33
+ f"Expected {expected_schema}, got {schema}"
34
+ )
35
+
36
+
37
+ def _get_test_schema() -> dict[type[BaseModel], list[str]]:
38
+ return {
39
+ Msdp: ["effectiveDate", "externalId", "space"],
40
+ DescribableEntity: ["description", "externalId", "name", "space"],
41
+ ReportingSite: [
42
+ "description",
43
+ "externalId",
44
+ "name",
45
+ "space",
46
+ "timeZone",
47
+ "timeZone|description",
48
+ "timeZone|externalId",
49
+ "timeZone|name",
50
+ "timeZone|space",
51
+ ],
52
+ EventDetail: [
53
+ "externalId",
54
+ "refDiscipline",
55
+ "refDiscipline|description",
56
+ "refDiscipline|externalId",
57
+ "refDiscipline|name",
58
+ "refDiscipline|space",
59
+ "refEquipment",
60
+ "refEquipment|description",
61
+ "refEquipment|externalId",
62
+ "refEquipment|name",
63
+ "refEquipment|space",
64
+ "refEventCode",
65
+ "refEventCode|description",
66
+ "refEventCode|externalId",
67
+ "refEventCode|name",
68
+ "refEventCode|space",
69
+ "refMetricCode",
70
+ "refMetricCode|description",
71
+ "refMetricCode|externalId",
72
+ "refMetricCode|name",
73
+ "refMetricCode|space",
74
+ "refSubCategoryL1",
75
+ "refSubCategoryL1|description",
76
+ "refSubCategoryL1|externalId",
77
+ "refSubCategoryL1|name",
78
+ "refSubCategoryL1|space",
79
+ "refSubCategoryL2",
80
+ "refSubCategoryL2|description",
81
+ "refSubCategoryL2|externalId",
82
+ "refSubCategoryL2|name",
83
+ "refSubCategoryL2|space",
84
+ "refSubCategoryL3",
85
+ "refSubCategoryL3|description",
86
+ "refSubCategoryL3|externalId",
87
+ "refSubCategoryL3|name",
88
+ "refSubCategoryL3|space",
89
+ "refSubCategoryL4",
90
+ "refSubCategoryL4|description",
91
+ "refSubCategoryL4|externalId",
92
+ "refSubCategoryL4|name",
93
+ "refSubCategoryL4|space",
94
+ "refSubCategoryL5",
95
+ "refSubCategoryL5|description",
96
+ "refSubCategoryL5|externalId",
97
+ "refSubCategoryL5|name",
98
+ "refSubCategoryL5|space",
99
+ "space",
100
+ ],
101
+ Event: [
102
+ "externalId",
103
+ "refMaterial",
104
+ "refMaterial|description",
105
+ "refMaterial|externalId",
106
+ "refMaterial|name",
107
+ "refMaterial|space",
108
+ "refOEEEventDetail",
109
+ "refOEEEventDetail|externalId",
110
+ "refOEEEventDetail|refDiscipline",
111
+ "refOEEEventDetail|refDiscipline|description",
112
+ "refOEEEventDetail|refDiscipline|externalId",
113
+ "refOEEEventDetail|refDiscipline|name",
114
+ "refOEEEventDetail|refDiscipline|space",
115
+ "refOEEEventDetail|refEquipment",
116
+ "refOEEEventDetail|refEquipment|description",
117
+ "refOEEEventDetail|refEquipment|externalId",
118
+ "refOEEEventDetail|refEquipment|name",
119
+ "refOEEEventDetail|refEquipment|space",
120
+ "refOEEEventDetail|refEventCode",
121
+ "refOEEEventDetail|refEventCode|description",
122
+ "refOEEEventDetail|refEventCode|externalId",
123
+ "refOEEEventDetail|refEventCode|name",
124
+ "refOEEEventDetail|refEventCode|space",
125
+ "refOEEEventDetail|refMetricCode",
126
+ "refOEEEventDetail|refMetricCode|description",
127
+ "refOEEEventDetail|refMetricCode|externalId",
128
+ "refOEEEventDetail|refMetricCode|name",
129
+ "refOEEEventDetail|refMetricCode|space",
130
+ "refOEEEventDetail|refSubCategoryL1",
131
+ "refOEEEventDetail|refSubCategoryL1|description",
132
+ "refOEEEventDetail|refSubCategoryL1|externalId",
133
+ "refOEEEventDetail|refSubCategoryL1|name",
134
+ "refOEEEventDetail|refSubCategoryL1|space",
135
+ "refOEEEventDetail|refSubCategoryL2",
136
+ "refOEEEventDetail|refSubCategoryL2|description",
137
+ "refOEEEventDetail|refSubCategoryL2|externalId",
138
+ "refOEEEventDetail|refSubCategoryL2|name",
139
+ "refOEEEventDetail|refSubCategoryL2|space",
140
+ "refOEEEventDetail|refSubCategoryL3",
141
+ "refOEEEventDetail|refSubCategoryL3|description",
142
+ "refOEEEventDetail|refSubCategoryL3|externalId",
143
+ "refOEEEventDetail|refSubCategoryL3|name",
144
+ "refOEEEventDetail|refSubCategoryL3|space",
145
+ "refOEEEventDetail|refSubCategoryL4",
146
+ "refOEEEventDetail|refSubCategoryL4|description",
147
+ "refOEEEventDetail|refSubCategoryL4|externalId",
148
+ "refOEEEventDetail|refSubCategoryL4|name",
149
+ "refOEEEventDetail|refSubCategoryL4|space",
150
+ "refOEEEventDetail|refSubCategoryL5",
151
+ "refOEEEventDetail|refSubCategoryL5|description",
152
+ "refOEEEventDetail|refSubCategoryL5|externalId",
153
+ "refOEEEventDetail|refSubCategoryL5|name",
154
+ "refOEEEventDetail|refSubCategoryL5|space",
155
+ "refOEEEventDetail|space",
156
+ "refProcessType",
157
+ "refProcessType|description",
158
+ "refProcessType|externalId",
159
+ "refProcessType|name",
160
+ "refProcessType|space",
161
+ "refProduct",
162
+ "refProduct|description",
163
+ "refProduct|externalId",
164
+ "refProduct|name",
165
+ "refProduct|space",
166
+ "refReportingLine",
167
+ "refReportingLine|description",
168
+ "refReportingLine|externalId",
169
+ "refReportingLine|name",
170
+ "refReportingLine|space",
171
+ "refReportingLocation",
172
+ "refReportingLocation|description",
173
+ "refReportingLocation|externalId",
174
+ "refReportingLocation|name",
175
+ "refReportingLocation|space",
176
+ "refSite",
177
+ "refSite|description",
178
+ "refSite|externalId",
179
+ "refSite|name",
180
+ "refSite|space",
181
+ "refSite|timeZone",
182
+ "refSite|timeZone|description",
183
+ "refSite|timeZone|externalId",
184
+ "refSite|timeZone|name",
185
+ "refSite|timeZone|space",
186
+ "refUnit",
187
+ "refUnit|description",
188
+ "refUnit|externalId",
189
+ "refUnit|name",
190
+ "refUnit|space",
191
+ "space",
192
+ "startDateTime",
193
+ ],
194
+ WritableEvent: [
195
+ "externalId",
196
+ "refOEEEventDetail",
197
+ "refOEEEventDetail|externalId",
198
+ "refOEEEventDetail|refDiscipline",
199
+ "refOEEEventDetail|refDiscipline|description",
200
+ "refOEEEventDetail|refDiscipline|externalId",
201
+ "refOEEEventDetail|refDiscipline|name",
202
+ "refOEEEventDetail|refDiscipline|space",
203
+ "refOEEEventDetail|refEquipment",
204
+ "refOEEEventDetail|refEquipment|description",
205
+ "refOEEEventDetail|refEquipment|externalId",
206
+ "refOEEEventDetail|refEquipment|name",
207
+ "refOEEEventDetail|refEquipment|space",
208
+ "refOEEEventDetail|refEventCode",
209
+ "refOEEEventDetail|refEventCode|description",
210
+ "refOEEEventDetail|refEventCode|externalId",
211
+ "refOEEEventDetail|refEventCode|name",
212
+ "refOEEEventDetail|refEventCode|space",
213
+ "refOEEEventDetail|refMetricCode",
214
+ "refOEEEventDetail|refMetricCode|description",
215
+ "refOEEEventDetail|refMetricCode|externalId",
216
+ "refOEEEventDetail|refMetricCode|name",
217
+ "refOEEEventDetail|refMetricCode|space",
218
+ "refOEEEventDetail|refSubCategoryL1",
219
+ "refOEEEventDetail|refSubCategoryL1|description",
220
+ "refOEEEventDetail|refSubCategoryL1|externalId",
221
+ "refOEEEventDetail|refSubCategoryL1|name",
222
+ "refOEEEventDetail|refSubCategoryL1|space",
223
+ "refOEEEventDetail|refSubCategoryL2",
224
+ "refOEEEventDetail|refSubCategoryL2|description",
225
+ "refOEEEventDetail|refSubCategoryL2|externalId",
226
+ "refOEEEventDetail|refSubCategoryL2|name",
227
+ "refOEEEventDetail|refSubCategoryL2|space",
228
+ "refOEEEventDetail|refSubCategoryL3",
229
+ "refOEEEventDetail|refSubCategoryL3|description",
230
+ "refOEEEventDetail|refSubCategoryL3|externalId",
231
+ "refOEEEventDetail|refSubCategoryL3|name",
232
+ "refOEEEventDetail|refSubCategoryL3|space",
233
+ "refOEEEventDetail|refSubCategoryL4",
234
+ "refOEEEventDetail|refSubCategoryL4|description",
235
+ "refOEEEventDetail|refSubCategoryL4|externalId",
236
+ "refOEEEventDetail|refSubCategoryL4|name",
237
+ "refOEEEventDetail|refSubCategoryL4|space",
238
+ "refOEEEventDetail|refSubCategoryL5",
239
+ "refOEEEventDetail|refSubCategoryL5|description",
240
+ "refOEEEventDetail|refSubCategoryL5|externalId",
241
+ "refOEEEventDetail|refSubCategoryL5|name",
242
+ "refOEEEventDetail|refSubCategoryL5|space",
243
+ "refOEEEventDetail|space",
244
+ "refReportingLine",
245
+ "refReportingLine|description",
246
+ "refReportingLine|externalId",
247
+ "refReportingLine|name",
248
+ "refReportingLine|space",
249
+ "refSite",
250
+ "refSite|description",
251
+ "refSite|externalId",
252
+ "refSite|name",
253
+ "refSite|space",
254
+ "refSite|timeZone",
255
+ "refSite|timeZone|description",
256
+ "refSite|timeZone|externalId",
257
+ "refSite|timeZone|name",
258
+ "refSite|timeZone|space",
259
+ "space",
260
+ "startDateTime",
261
+ ],
262
+ SuperNestedModel: [
263
+ "cars",
264
+ "cars|model",
265
+ "cars|owner",
266
+ "cars|owner|cars",
267
+ "cars|owner|cars|model",
268
+ "cars|owner|cars|owner",
269
+ "cars|owner|cars|previous_owners",
270
+ "cars|owner|cars|year",
271
+ "cars|owner|children",
272
+ "cars|owner|description",
273
+ "cars|owner|externalId",
274
+ "cars|owner|name",
275
+ "cars|owner|parent",
276
+ "cars|owner|parent|cars",
277
+ "cars|owner|parent|cars|model",
278
+ "cars|owner|parent|cars|owner",
279
+ "cars|owner|parent|cars|previous_owners",
280
+ "cars|owner|parent|cars|year",
281
+ "cars|owner|parent|children",
282
+ "cars|owner|parent|description",
283
+ "cars|owner|parent|externalId",
284
+ "cars|owner|parent|name",
285
+ "cars|owner|parent|parent",
286
+ "cars|owner|parent|parent|cars",
287
+ "cars|owner|parent|parent|cars|model",
288
+ "cars|owner|parent|parent|cars|owner",
289
+ "cars|owner|parent|parent|cars|previous_owners",
290
+ "cars|owner|parent|parent|cars|year",
291
+ "cars|owner|parent|parent|children",
292
+ "cars|owner|parent|parent|description",
293
+ "cars|owner|parent|parent|externalId",
294
+ "cars|owner|parent|parent|name",
295
+ "cars|owner|parent|parent|parent",
296
+ "cars|owner|parent|parent|space",
297
+ "cars|owner|parent|space",
298
+ "cars|owner|space",
299
+ "cars|previous_owners",
300
+ "cars|year",
301
+ "children",
302
+ "children|cars",
303
+ "children|cars|model",
304
+ "children|cars|owner",
305
+ "children|cars|previous_owners",
306
+ "children|cars|year",
307
+ "children|children",
308
+ "children|description",
309
+ "children|externalId",
310
+ "children|name",
311
+ "children|parent",
312
+ "children|parent|cars",
313
+ "children|parent|cars|model",
314
+ "children|parent|cars|owner",
315
+ "children|parent|cars|previous_owners",
316
+ "children|parent|cars|year",
317
+ "children|parent|children",
318
+ "children|parent|description",
319
+ "children|parent|externalId",
320
+ "children|parent|name",
321
+ "children|parent|parent",
322
+ "children|parent|space",
323
+ "children|space",
324
+ "description",
325
+ "externalId",
326
+ "name",
327
+ "parent",
328
+ "parent|cars",
329
+ "parent|cars|model",
330
+ "parent|cars|owner",
331
+ "parent|cars|previous_owners",
332
+ "parent|cars|year",
333
+ "parent|children",
334
+ "parent|description",
335
+ "parent|externalId",
336
+ "parent|name",
337
+ "parent|parent",
338
+ "parent|parent|cars",
339
+ "parent|parent|cars|model",
340
+ "parent|parent|cars|owner",
341
+ "parent|parent|cars|previous_owners",
342
+ "parent|parent|cars|year",
343
+ "parent|parent|children",
344
+ "parent|parent|description",
345
+ "parent|parent|externalId",
346
+ "parent|parent|name",
347
+ "parent|parent|parent",
348
+ "parent|parent|space",
349
+ "parent|space",
350
+ "space",
351
+ ],
352
+ }
@@ -215,7 +215,7 @@ wheels = [
215
215
 
216
216
  [[package]]
217
217
  name = "industrial-model"
218
- version = "0.1.19"
218
+ version = "0.1.21"
219
219
  source = { editable = "." }
220
220
  dependencies = [
221
221
  { name = "anyio" },
@@ -1 +0,0 @@
1
- uv build