cognite-extractor-utils 7.5.3__py3-none-any.whl → 7.5.4__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.

Potentially problematic release.


This version of cognite-extractor-utils might be problematic. Click here for more details.

@@ -16,5 +16,5 @@
16
16
  Cognite extractor utils is a Python package that simplifies the development of new extractors.
17
17
  """
18
18
 
19
- __version__ = "7.5.3"
19
+ __version__ = "7.5.4"
20
20
  from .base import Extractor
@@ -25,7 +25,7 @@ from httpx import URL, Client, Headers, Request, StreamConsumed, SyncByteStream
25
25
  from requests.utils import super_len
26
26
 
27
27
  from cognite.client import CogniteClient
28
- from cognite.client.data_classes import FileMetadata
28
+ from cognite.client.data_classes import FileMetadata, FileMetadataUpdate
29
29
  from cognite.client.data_classes.data_modeling import NodeId
30
30
  from cognite.client.data_classes.data_modeling.extractor_extensions.v1 import CogniteExtractorFileApply
31
31
  from cognite.client.utils._identifier import IdentifierSequence
@@ -261,13 +261,23 @@ class IOFileUploadQueue(AbstractUploadQueue):
261
261
  file_meta_response, url = self.cdf_client.files.create(
262
262
  file_metadata=file_meta, overwrite=self.overwrite_existing
263
263
  )
264
- # trigger update after creation (upsert =P)
265
- basic_attributes = set(["externalId", "name"])
266
- attr = set(file_meta.dump().keys())
267
- diff = attr - basic_attributes
268
264
 
269
- if len(diff) >= 1 and "externalId" in attr:
270
- file_meta_response = self.cdf_client.files.update(file_meta)
265
+ # The files API for whatever reason doesn't update directory or source when you overwrite,
266
+ # so we need to update those later.
267
+ any_unchaged = (
268
+ file_meta_response.directory != file_meta.directory or file_meta_response.source != file_meta.source
269
+ )
270
+ if any_unchaged:
271
+ update = FileMetadataUpdate(external_id=file_meta.external_id)
272
+ any = False
273
+ if file_meta.source:
274
+ any = True
275
+ update.source.set(file_meta.source)
276
+ if file_meta.directory:
277
+ any = True
278
+ update.directory.set(file_meta.directory)
279
+ if any:
280
+ self.cdf_client.files.update(update)
271
281
 
272
282
  return file_meta_response, url
273
283
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cognite-extractor-utils
3
- Version: 7.5.3
3
+ Version: 7.5.4
4
4
  Summary: Utilities for easier development of extractors for CDF
5
5
  Home-page: https://github.com/cognitedata/python-extractor-utils
6
6
  License: Apache-2.0
@@ -1,4 +1,4 @@
1
- cognite/extractorutils/__init__.py,sha256=pPFTl6NLy80gdrqOyixILBqEX521PLVQ02LBFTve8f4,739
1
+ cognite/extractorutils/__init__.py,sha256=3EXu1PpneUoKYLLIAlPg5-z059GC1YWnFCbRNJrDfk0,739
2
2
  cognite/extractorutils/_inner_util.py,sha256=gmz6aqS7jDNsg8z4RHgJjMFohDLOMiaU4gMWBhg3xcE,1558
3
3
  cognite/extractorutils/base.py,sha256=q6NU2bPec3WOasVnnIFoh-aUJudVZWZ2R6emz3IRj8Q,16391
4
4
  cognite/extractorutils/configtools/__init__.py,sha256=YEpFGJoza23eM8Zj5DqqUj7sEstERV_QYsN6Nw4dKCg,3092
@@ -34,13 +34,13 @@ cognite/extractorutils/uploader/_metrics.py,sha256=J2LJXb19L_SLSJ_voNIQHYLp0pjxU
34
34
  cognite/extractorutils/uploader/assets.py,sha256=2E90N1kxsaA6Ah4h0_r_dTVhDYY_68ItRWrHYkkltJw,5628
35
35
  cognite/extractorutils/uploader/data_modeling.py,sha256=w35Ix5mu0Cgfn4ywnDyif4VVjo04LVTlkMEevk6ztUs,3639
36
36
  cognite/extractorutils/uploader/events.py,sha256=NZP2tMoU_rh_rb-EZiUBsOT5KdNABHN4c9Oddk0OsdE,5680
37
- cognite/extractorutils/uploader/files.py,sha256=9yLtqStAQuFj33Fi12zo5HJYo-HdVYop8tkAHsmhHXg,22581
37
+ cognite/extractorutils/uploader/files.py,sha256=OYBLQXzS1HLDd_g5KrcwmwITjCVYLqXKuP0lWFrgpr0,23047
38
38
  cognite/extractorutils/uploader/raw.py,sha256=wFjF90PFTjmByOWx_Y4_YfDJ2w2jl0EQJ2Tjx2MP2PM,6738
39
39
  cognite/extractorutils/uploader/time_series.py,sha256=HBtQdsQoIOaL-EG5lMsaY-ORwVb0kGiXG86VjE5-_Bg,26815
40
40
  cognite/extractorutils/uploader_extractor.py,sha256=E-mpVvbPg_Tk90U4S9JybV0duptJ2SXE88HB6npE3zI,7732
41
41
  cognite/extractorutils/uploader_types.py,sha256=wxfrsiKPTzG5lmoYtQsxt8Xyj-s5HnaLl8WDzJNrazg,1020
42
42
  cognite/extractorutils/util.py,sha256=cFrbO8XCFT7QBs2vvOk4dWyOvaHclvsuPlrDJYFG0xA,21160
43
- cognite_extractor_utils-7.5.3.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
44
- cognite_extractor_utils-7.5.3.dist-info/METADATA,sha256=x0308F0NAw1FCHdlbzqmlPxEwXWaK7wOIbPNq-oVLQA,5649
45
- cognite_extractor_utils-7.5.3.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
46
- cognite_extractor_utils-7.5.3.dist-info/RECORD,,
43
+ cognite_extractor_utils-7.5.4.dist-info/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
44
+ cognite_extractor_utils-7.5.4.dist-info/METADATA,sha256=ylZnUNTFglZUVhZQsiVIOg-ChKYpKO6lsfhIR2g8JsM,5649
45
+ cognite_extractor_utils-7.5.4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
46
+ cognite_extractor_utils-7.5.4.dist-info/RECORD,,