cognite-neat 1.0.18__py3-none-any.whl → 1.0.20__py3-none-any.whl

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.
@@ -152,6 +152,7 @@ class DMSView(TableObj):
152
152
  description: str | None = None
153
153
  implements: EntityList | None = None
154
154
  filter: str | None = None
155
+ in_model: bool | None = Field(None, exclude=True, description="Legacy column")
155
156
 
156
157
  @field_validator("filter", mode="after")
157
158
  def _legacy_filter(cls, value: str | None) -> str | None:
@@ -231,6 +232,31 @@ class TableDMS(TableObj):
231
232
  return {title_case(k): v for k, v in data.items()}
232
233
  return data
233
234
 
235
+ @model_validator(mode="after")
236
+ def _drop_in_model_false_views_definitions(self) -> "TableDMS":
237
+ """These method is used to drop definition of legacy views which have In Model column set to False
238
+ We need to drop these views from Views sheet and also drop their properties from Properties sheet.
239
+ """
240
+
241
+ views_to_drop: set[Entity] = set()
242
+ for view in self.views:
243
+ if isinstance(view.in_model, bool) and not view.in_model:
244
+ views_to_drop.add(view.view)
245
+
246
+ if not views_to_drop:
247
+ return self
248
+
249
+ print(
250
+ "You are using legacy `In Model` column which is no longer in use!"
251
+ f"\nTotal of {len(views_to_drop)} views has `In Model` set to False."
252
+ f"\nThese views and their property definitions will be dropped from the session!"
253
+ )
254
+
255
+ self.views = [view for view in self.views if view.view not in views_to_drop]
256
+ self.properties = [prop for prop in self.properties if prop.view not in views_to_drop]
257
+
258
+ return self
259
+
234
260
  @classmethod
235
261
  def get_sheet_columns(
236
262
  cls, sheet_id: str, sheet: FieldInfo | None = None, *, column_type: Literal["all", "required"] = "required"
@@ -106,7 +106,7 @@ class ReadPhysicalDataModel:
106
106
  on_success = DmsDataModelValidation(
107
107
  modus_operandi=self._config.modeling.mode,
108
108
  cdf_snapshot=self._store.cdf_snapshot,
109
- limits=self._store.limits,
109
+ limits=self._store.cdf_limits,
110
110
  can_run_validator=self._config.validation.can_run_validator,
111
111
  enable_alpha_validators=self._config.alpha.enable_experimental_validators,
112
112
  )
@@ -135,7 +135,7 @@ class ReadPhysicalDataModel:
135
135
  on_success = DmsDataModelValidation(
136
136
  modus_operandi=self._config.modeling.mode,
137
137
  cdf_snapshot=self._store.cdf_snapshot,
138
- limits=self._store.limits,
138
+ limits=self._store.cdf_limits,
139
139
  can_run_validator=self._config.validation.can_run_validator,
140
140
  enable_alpha_validators=self._config.alpha.enable_experimental_validators,
141
141
  )
@@ -155,7 +155,7 @@ class ReadPhysicalDataModel:
155
155
  on_success = DmsDataModelValidation(
156
156
  modus_operandi=self._config.modeling.mode,
157
157
  cdf_snapshot=self._store.cdf_snapshot,
158
- limits=self._store.limits,
158
+ limits=self._store.cdf_limits,
159
159
  can_run_validator=self._config.validation.can_run_validator,
160
160
  enable_alpha_validators=self._config.alpha.enable_experimental_validators,
161
161
  )
@@ -178,7 +178,7 @@ class ReadPhysicalDataModel:
178
178
  on_success = DmsDataModelValidation(
179
179
  modus_operandi=self._config.modeling.mode,
180
180
  cdf_snapshot=self._store.cdf_snapshot,
181
- limits=self._store.limits,
181
+ limits=self._store.cdf_limits,
182
182
  can_run_validator=self._config.validation.can_run_validator,
183
183
  enable_alpha_validators=self._config.alpha.enable_experimental_validators,
184
184
  )
@@ -34,9 +34,21 @@ class NeatStore:
34
34
  self._client = client
35
35
  self._config = config
36
36
 
37
- # Caching CDF Schema limits and snapshot
38
- self.limits = SchemaLimits.from_api_response(self._client.statistics.project())
39
- self.cdf_snapshot = SchemaSnapshot.fetch_entire_cdf(self._client)
37
+ # Placeholder for CDF schema and limit snapshot
38
+ self._cdf_snapshot: SchemaSnapshot | None = None
39
+ self._cdf_limits: SchemaLimits | None = None
40
+
41
+ @property
42
+ def cdf_limits(self) -> SchemaLimits:
43
+ if not self._cdf_limits:
44
+ self._cdf_limits = SchemaLimits.from_api_response(self._client.statistics.project())
45
+ return self._cdf_limits
46
+
47
+ @property
48
+ def cdf_snapshot(self) -> SchemaSnapshot:
49
+ if not self._cdf_snapshot:
50
+ self._cdf_snapshot = SchemaSnapshot.fetch_entire_cdf(self._client)
51
+ return self._cdf_snapshot
40
52
 
41
53
  def read_physical(self, reader: DMSImporter, on_success: OnSuccess | None = None) -> None:
42
54
  """Read object from the store"""
@@ -81,7 +93,7 @@ class NeatStore:
81
93
  and not on_success.options.dry_run
82
94
  ):
83
95
  # Update CDF snapshot after successful deployment
84
- self.cdf_snapshot = SchemaSnapshot.fetch_entire_cdf(self._client)
96
+ self._cdf_snapshot = SchemaSnapshot.fetch_entire_cdf(self._client)
85
97
 
86
98
  def _gather_data_model(self, writer: DMSExporter) -> PhysicalDataModel:
87
99
  """Gather the current physical data model from the store
cognite/neat/_version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "1.0.18"
1
+ __version__ = "1.0.20"
2
2
  __engine__ = "^2.0.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite-neat
3
- Version: 1.0.18
3
+ Version: 1.0.20
4
4
  Summary: Knowledge graph transformation
5
5
  Author: Nikola Vasiljevic, Anders Albert
6
6
  Author-email: Nikola Vasiljevic <nikola.vasiljevic@cognite.com>, Anders Albert <anders.albert@cognite.com>
@@ -35,7 +35,7 @@ cognite/neat/_data_model/importers/__init__.py,sha256=dHnKnC_AXk42z6wzEHK15dxIOh
35
35
  cognite/neat/_data_model/importers/_api_importer.py,sha256=H8Ow3Tt7utuAuBhC6s7yWvhGqunHAtE0r0XRsVAr6IE,7280
36
36
  cognite/neat/_data_model/importers/_base.py,sha256=NRB0FcEBj4GaethU68nRffBfTedBBA866A3zfJNfmiQ,433
37
37
  cognite/neat/_data_model/importers/_table_importer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
- cognite/neat/_data_model/importers/_table_importer/data_classes.py,sha256=-S379Apvz2QSchBTG89mrVdOrAo7LH_O1kjqMOlv-fk,9619
38
+ cognite/neat/_data_model/importers/_table_importer/data_classes.py,sha256=MU3gZg9w3OO0FCJfYdbfa4e8tSNPVhkPOzpJNab4jG4,10762
39
39
  cognite/neat/_data_model/importers/_table_importer/importer.py,sha256=lQ4_Gpv0haEwQEDYZJaxtR9dL6Y0ys9jbjFfWxH6s2o,8870
40
40
  cognite/neat/_data_model/importers/_table_importer/reader.py,sha256=I9-zHCpJLo7bj4BabAzSgNBDVUAocdhlvBfy95JkWRw,49451
41
41
  cognite/neat/_data_model/importers/_table_importer/source.py,sha256=h7u5ur5oetmvBs3wgj7Ody5uPF21QwxeAceoIhJ5qzo,3300
@@ -94,7 +94,7 @@ cognite/neat/_session/_html/templates/__init__.py,sha256=hgufJuBxUZ2nLCMTCxGixmk
94
94
  cognite/neat/_session/_html/templates/deployment.html,sha256=aLDXMbF3pcSqnCpUYVGmIWfqU2jyYUUTaGfpSHRLzdU,3715
95
95
  cognite/neat/_session/_html/templates/issues.html,sha256=zjhkJcPK0hMp_ZKJ9RCf88tuZxQyTYRPxzpqx33Nkt0,1661
96
96
  cognite/neat/_session/_issues.py,sha256=E8UQeSJURg2dm4MF1pfD9dp-heSRT7pgQZgKlD1-FGs,2723
97
- cognite/neat/_session/_physical.py,sha256=uQ1ny5Sy3mvkSIdT5kaCwlDCA1W2U-RQouITNAu7TE0,12433
97
+ cognite/neat/_session/_physical.py,sha256=e3i9xuLa4bMOa-mJxbf4AyLZ2UnPOPh05P-E7E0lRHY,12449
98
98
  cognite/neat/_session/_result/__init__.py,sha256=8A0BKgsqnjxkiHUlCpHBNl3mrFWtyjaWYnh0jssE6QU,50
99
99
  cognite/neat/_session/_result/_deployment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
100
100
  cognite/neat/_session/_result/_deployment/_physical/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -113,7 +113,7 @@ cognite/neat/_state_machine/_base.py,sha256=-ZpeAhM6l6N6W70dET25tAzOxaaK5aa474ea
113
113
  cognite/neat/_state_machine/_states.py,sha256=nmj4SmunpDYcBsNx8A284xnXGS43wuUuWpMMORha2DE,1170
114
114
  cognite/neat/_store/__init__.py,sha256=TvM9CcFbtOSrxydPAuJi6Bv_iiGard1Mxfx42ZFoTl0,55
115
115
  cognite/neat/_store/_provenance.py,sha256=1zzRDWjR9twZu2jVyIG3UdYdIXtQKJ7uF8a0hV7LEuA,3368
116
- cognite/neat/_store/_store.py,sha256=Jibx6kKAH8V6iUOegDOcSLTplGLxmuXCLfjbdff_wvI,9367
116
+ cognite/neat/_store/_store.py,sha256=PwW4hYQ-ENbCtKpGdGmsJjk0qGU4PPg0LIfhn5nNGSI,9751
117
117
  cognite/neat/_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
118
118
  cognite/neat/_utils/_reader.py,sha256=9dXrODNNqWU0Gx1zXjRTOiiByFuDZlpQkQEzx3HAxYQ,5390
119
119
  cognite/neat/_utils/auxiliary.py,sha256=Cx-LP8dfN782R3iUcm--q26zdzQ0k_RFnVbJ0bwVZMI,1345
@@ -316,9 +316,9 @@ cognite/neat/_v0/session/_template.py,sha256=BNcvrW5y7LWzRM1XFxZkfR1Nc7e8UgjBClH
316
316
  cognite/neat/_v0/session/_to.py,sha256=AnsRSDDdfFyYwSgi0Z-904X7WdLtPfLlR0x1xsu_jAo,19447
317
317
  cognite/neat/_v0/session/_wizard.py,sha256=baPJgXAAF3d1bn4nbIzon1gWfJOeS5T43UXRDJEnD3c,1490
318
318
  cognite/neat/_v0/session/exceptions.py,sha256=jv52D-SjxGfgqaHR8vnpzo0SOJETIuwbyffSWAxSDJw,3495
319
- cognite/neat/_version.py,sha256=Buh8SWFXU0sxa-m7s9PiJfRvoR-zxpBJB4QrFLZmqHk,45
319
+ cognite/neat/_version.py,sha256=sA2ZsS8D9yHBhDKFo6czh0Y817b0hccxIxB45Dzk75o,45
320
320
  cognite/neat/legacy.py,sha256=eI2ecxOV8ilGHyLZlN54ve_abtoK34oXognkFv3yvF0,219
321
321
  cognite/neat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
322
- cognite_neat-1.0.18.dist-info/WHEEL,sha256=eycQt0QpYmJMLKpE3X9iDk8R04v2ZF0x82ogq-zP6bQ,79
323
- cognite_neat-1.0.18.dist-info/METADATA,sha256=7Lg6EUBwa0BYxDgRz8iNpZY8kim0xsRIqRCDSHhYLFo,6689
324
- cognite_neat-1.0.18.dist-info/RECORD,,
322
+ cognite_neat-1.0.20.dist-info/WHEEL,sha256=eycQt0QpYmJMLKpE3X9iDk8R04v2ZF0x82ogq-zP6bQ,79
323
+ cognite_neat-1.0.20.dist-info/METADATA,sha256=-nVza3PgQsgHSNGru9JTxml_7T4k4UqxhQo4hrbMMG0,6689
324
+ cognite_neat-1.0.20.dist-info/RECORD,,