industrial-model 0.1.29__py3-none-any.whl → 0.1.30__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.
@@ -62,15 +62,7 @@ class UpsertMapper:
62
62
  entry = instance.__getattribute__(property_key)
63
63
 
64
64
  if isinstance(property, MappedProperty):
65
- properties[property_name] = (
66
- DirectRelationReference(
67
- space=entry.space, external_id=entry.external_id
68
- )
69
- if isinstance(entry, InstanceId)
70
- else datetime_to_ms_iso_timestamp(entry)
71
- if isinstance(entry, datetime.datetime)
72
- else entry
73
- )
65
+ properties[property_name] = self._get_mapped_property_value(entry)
74
66
  elif isinstance(property, EdgeConnection) and isinstance(entry, list):
75
67
  possible_entries = self._map_edges(instance, property, entry)
76
68
 
@@ -102,6 +94,20 @@ class UpsertMapper:
102
94
 
103
95
  return node, edges, edges_to_delete
104
96
 
97
+ def _get_mapped_property_value(self, entry: Any) -> Any:
98
+ if isinstance(entry, list):
99
+ return [self._get_mapped_property_value(item) for item in entry]
100
+
101
+ if isinstance(entry, InstanceId):
102
+ return DirectRelationReference(
103
+ space=entry.space, external_id=entry.external_id
104
+ )
105
+ if isinstance(entry, datetime.date):
106
+ return entry.strftime("%Y-%m-%d")
107
+ if isinstance(entry, datetime.datetime):
108
+ return datetime_to_ms_iso_timestamp(entry)
109
+ return entry
110
+
105
111
  def _map_edges(
106
112
  self,
107
113
  instance: TWritableViewInstance,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: industrial-model
3
- Version: 0.1.29
3
+ Version: 0.1.30
4
4
  Summary: Industrial Model ORM
5
5
  Author-email: Lucas Alves <lucasrosaalves@gmail.com>
6
6
  Classifier: Programming Language :: Python
@@ -12,7 +12,7 @@ industrial_model/cognite_adapters/query_mapper.py,sha256=QdFVkfmL4tWcCy_oypOluT0
12
12
  industrial_model/cognite_adapters/query_result_mapper.py,sha256=iCcTb0AUg5rtw8nhK7D4d_x6Z53zgNMpvWrVRM0R2pY,9315
13
13
  industrial_model/cognite_adapters/search_mapper.py,sha256=dh69Te8oiDIRPbEMTcof-ZJ4XD-xB5iiBHUR0UETzho,1504
14
14
  industrial_model/cognite_adapters/sort_mapper.py,sha256=RJUAYlZGXoYzK0PwX63cibRF_L-MUq9g2ZsC2EeNIF4,696
15
- industrial_model/cognite_adapters/upsert_mapper.py,sha256=2QN4LXdUTWDmnLmXGKOLnCdTnUm5Zz2sZXD80-kAeQM,4720
15
+ industrial_model/cognite_adapters/upsert_mapper.py,sha256=fIz2WLnn0YpsgotGH2MXAa9QYWjQehpWsX3MAKhvRkw,4951
16
16
  industrial_model/cognite_adapters/utils.py,sha256=-9NUG84r49cKvmmzoUinxNF1zhHIlmoWFypUCD_WTeM,4800
17
17
  industrial_model/cognite_adapters/view_mapper.py,sha256=fihoxyLKvq8xa1oArdCCkukqVpOexFcBDnEyMACpHF8,1430
18
18
  industrial_model/engines/__init__.py,sha256=7aGHrUm2MxIq39vR8h0xu3i1zNOuT9H9U-q4lV3nErQ,102
@@ -28,6 +28,6 @@ industrial_model/queries/params.py,sha256=50qY5BO5onLsXorhcv-7qCKhJaMO94UzhKLCmZ
28
28
  industrial_model/queries/utils.py,sha256=uP6PLh9IVHDK6J8x444zHWPmyV4PkxdLO-PMc6qWItc,1505
29
29
  industrial_model/statements/__init__.py,sha256=rjLRo2KoazHQaOpmPkxbI3_Nm8NCkJxjpuqow6IZVSc,4221
30
30
  industrial_model/statements/expressions.py,sha256=4ZZOcZroI5-4xRw4PXIRlufi0ARndE5zSbbxLDpR2Ec,4816
31
- industrial_model-0.1.29.dist-info/METADATA,sha256=vNGyeERDw-3hlRpxgxKjGERKp8VhwNPBhYRzoqWlArA,6858
32
- industrial_model-0.1.29.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
33
- industrial_model-0.1.29.dist-info/RECORD,,
31
+ industrial_model-0.1.30.dist-info/METADATA,sha256=r4KKWy2zg_TDqDCvkMTSJ8TyrsT105tRKASNb3XyxMM,6858
32
+ industrial_model-0.1.30.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
33
+ industrial_model-0.1.30.dist-info/RECORD,,