cognite-toolkit 0.7.55__py3-none-any.whl → 0.7.56__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.
@@ -1,6 +1,6 @@
1
1
  import sys
2
2
  from collections.abc import Collection, Iterator
3
- from typing import Any, Generic, Protocol, TypeVar
3
+ from typing import Any, Generic, Protocol, TypeVar, runtime_checkable
4
4
 
5
5
  from cognite.client import CogniteClient
6
6
 
@@ -10,6 +10,7 @@ else:
10
10
  from typing_extensions import Self
11
11
 
12
12
 
13
+ @runtime_checkable
13
14
  class ResourceRequestProtocol(Protocol):
14
15
  @classmethod
15
16
  def _load(cls, data: dict[str, Any]) -> Self: ...
@@ -17,6 +18,7 @@ class ResourceRequestProtocol(Protocol):
17
18
  def dump(self, camel_case: bool = True) -> dict[str, Any]: ...
18
19
 
19
20
 
21
+ @runtime_checkable
20
22
  class ResourceResponseProtocol(Protocol):
21
23
  def as_write(self) -> ResourceRequestProtocol: ...
22
24
 
@@ -7,11 +7,11 @@ from pydantic import JsonValue
7
7
  from cognite_toolkit._cdf_tk.client import ToolkitClient
8
8
  from cognite_toolkit._cdf_tk.client.http_client import (
9
9
  HTTPClient,
10
- HTTPMessage,
11
10
  HTTPResult2,
12
11
  RequestMessage2,
13
12
  SuccessResponse2,
14
13
  )
14
+ from cognite_toolkit._cdf_tk.client.http_client._item_classes import ItemsResultList
15
15
  from cognite_toolkit._cdf_tk.client.resource_classes.legacy.canvas import (
16
16
  IndustrialCanvas,
17
17
  IndustrialCanvasApply,
@@ -189,9 +189,9 @@ class CanvasIO(UploadableStorageIO[CanvasSelector, IndustrialCanvas, IndustrialC
189
189
  data_chunk: Sequence[UploadItem[IndustrialCanvasApply]],
190
190
  http_client: HTTPClient,
191
191
  selector: CanvasSelector | None = None,
192
- ) -> Sequence[HTTPMessage]:
192
+ ) -> ItemsResultList:
193
193
  config = http_client.config
194
- results: list[HTTPMessage] = []
194
+ results = ItemsResultList()
195
195
  for item in data_chunk:
196
196
  instances = item.item.as_instances()
197
197
  upsert_items: list[dict[str, JsonValue]] = []
@@ -1,10 +1,14 @@
1
1
  from abc import ABC, abstractmethod
2
2
  from collections.abc import Iterable, Mapping, Sequence, Sized
3
3
  from dataclasses import dataclass
4
- from typing import ClassVar, Generic, Literal, TypeVar
4
+ from typing import Any, ClassVar, Generic, Literal, TypeVar
5
+
6
+ from pydantic import ConfigDict
5
7
 
6
8
  from cognite_toolkit._cdf_tk.client import ToolkitClient
7
- from cognite_toolkit._cdf_tk.client.http_client import HTTPClient, HTTPMessage, ItemsRequest
9
+ from cognite_toolkit._cdf_tk.client._resource_base import RequestItem
10
+ from cognite_toolkit._cdf_tk.client.http_client import HTTPClient
11
+ from cognite_toolkit._cdf_tk.client.http_client._item_classes import ItemsRequest2, ItemsResultList
8
12
  from cognite_toolkit._cdf_tk.exceptions import ToolkitNotImplementedError
9
13
  from cognite_toolkit._cdf_tk.protocols import T_ResourceRequest, T_ResourceResponse
10
14
  from cognite_toolkit._cdf_tk.utils.collection import chunker
@@ -36,8 +40,7 @@ class Page(Generic[T_ResourceResponse], Sized):
36
40
  return len(self.items)
37
41
 
38
42
 
39
- @dataclass
40
- class UploadItem(Generic[T_ResourceRequest]):
43
+ class UploadItem(RequestItem, Generic[T_ResourceRequest]):
41
44
  """An item to be uploaded to CDF, consisting of a source ID and the writable Cognite resource.
42
45
 
43
46
  Attributes:
@@ -45,14 +48,16 @@ class UploadItem(Generic[T_ResourceRequest]):
45
48
  item: The writable Cognite resource to be uploaded.
46
49
  """
47
50
 
51
+ model_config = ConfigDict(arbitrary_types_allowed=True)
52
+
48
53
  source_id: str
49
54
  item: T_ResourceRequest
50
55
 
51
- def as_id(self) -> str:
56
+ def __str__(self) -> str:
52
57
  return self.source_id
53
58
 
54
- def dump(self) -> JsonVal:
55
- return self.item.dump(camel_case=True)
59
+ def dump(self, camel_case: bool = True, exclude_extra: bool = False) -> dict[str, Any]:
60
+ return self.item.dump(camel_case=camel_case)
56
61
 
57
62
 
58
63
  class StorageIO(ABC, Generic[T_Selector, T_ResourceResponse]):
@@ -155,7 +160,7 @@ class UploadableStorageIO(
155
160
  data_chunk: Sequence[UploadItem[T_ResourceRequest]],
156
161
  http_client: HTTPClient,
157
162
  selector: T_Selector | None = None,
158
- ) -> Sequence[HTTPMessage]:
163
+ ) -> ItemsResultList:
159
164
  """Upload a chunk of data to the storage using a custom HTTP client.
160
165
  This ensures that even if one item in the chunk fails, the rest will still be uploaded.
161
166
 
@@ -179,11 +184,11 @@ class UploadableStorageIO(
179
184
  else:
180
185
  raise ToolkitNotImplementedError(f"Unsupported UPLOAD_ENDPOINT_TYPE {self.UPLOAD_ENDPOINT_TYPE!r}.")
181
186
 
182
- return http_client.request_with_retries(
183
- message=ItemsRequest(
187
+ return http_client.request_items_retries(
188
+ message=ItemsRequest2(
184
189
  endpoint_url=url,
185
190
  method=self.UPLOAD_ENDPOINT_METHOD,
186
- items=list(data_chunk),
191
+ items=data_chunk,
187
192
  extra_body_fields=dict(self.UPLOAD_EXTRA_ARGS or {}),
188
193
  )
189
194
  )
@@ -13,15 +13,16 @@ from cognite.client._proto.data_points_pb2 import (
13
13
  from cognite.client.data_classes import TimeSeriesFilter
14
14
  from cognite.client.data_classes.filters import Exists
15
15
  from cognite.client.data_classes.time_series import TimeSeriesProperty
16
+ from pydantic import ConfigDict
16
17
 
17
18
  from cognite_toolkit._cdf_tk.client import ToolkitClient
19
+ from cognite_toolkit._cdf_tk.client._resource_base import Identifier, RequestResource
18
20
  from cognite_toolkit._cdf_tk.client.http_client import (
19
- DataBodyRequest,
20
21
  HTTPClient,
21
- HTTPMessage,
22
- SimpleBodyRequest,
23
- SuccessResponse,
22
+ RequestMessage2,
23
+ SuccessResponse2,
24
24
  )
25
+ from cognite_toolkit._cdf_tk.client.http_client._item_classes import ItemsResultList
25
26
  from cognite_toolkit._cdf_tk.exceptions import ToolkitNotImplementedError
26
27
  from cognite_toolkit._cdf_tk.tk_warnings import HighSeverityWarning
27
28
  from cognite_toolkit._cdf_tk.utils import humanize_collection
@@ -39,9 +40,22 @@ from ._base import Page, TableStorageIO, TableUploadableStorageIO, UploadItem
39
40
  from .selectors import DataPointsDataSetSelector, DataPointsFileSelector, DataPointsSelector
40
41
 
41
42
 
43
+ class DatapointsRequestAdapter(RequestResource):
44
+ model_config = ConfigDict(arbitrary_types_allowed=True)
45
+ datapoints: DataPointInsertionRequest
46
+
47
+ def dump(self, camel_case: bool = True, exclude_extra: bool = False) -> dict[str, Any]:
48
+ return {"datapoints": self.datapoints.SerializeToString()}
49
+
50
+ def as_id(self) -> Identifier:
51
+ raise NotImplementedError(
52
+ "DatapointsRequestAdapter does not have an identifier. - it wraps multiple timeseries"
53
+ )
54
+
55
+
42
56
  class DatapointsIO(
43
57
  TableStorageIO[DataPointsSelector, DataPointListResponse],
44
- TableUploadableStorageIO[DataPointsSelector, DataPointListResponse, DataPointInsertionRequest],
58
+ TableUploadableStorageIO[DataPointsSelector, DataPointListResponse, DatapointsRequestAdapter],
45
59
  ):
46
60
  SUPPORTED_DOWNLOAD_FORMATS = frozenset({".csv"})
47
61
  SUPPORTED_COMPRESSIONS = frozenset({".gz"})
@@ -117,8 +131,8 @@ class DatapointsIO(
117
131
  }
118
132
  for ts in timeseries
119
133
  ]
120
- responses = self.client.http_client.request_with_retries(
121
- SimpleBodyRequest(
134
+ response = self.client.http_client.request_single_retries(
135
+ RequestMessage2(
122
136
  endpoint_url=config.create_api_url("/timeseries/data/list"),
123
137
  method="POST",
124
138
  accept="application/protobuf",
@@ -126,10 +140,9 @@ class DatapointsIO(
126
140
  body_content={"items": items}, # type: ignore[dict-item]
127
141
  )
128
142
  )
129
- first_success = next((resp for resp in responses if isinstance(resp, SuccessResponse)), None)
130
- if first_success is None:
143
+ if not isinstance(response, SuccessResponse2):
131
144
  continue
132
- aggregate_response: DataPointListResponse = DataPointListResponse.FromString(first_success.content)
145
+ aggregate_response: DataPointListResponse = DataPointListResponse.FromString(response.content)
133
146
  timeseries_ids_with_data: dict[int, int] = {}
134
147
  for dp in aggregate_response.items:
135
148
  if dp.aggregateDatapoints.datapoints:
@@ -176,8 +189,8 @@ class DatapointsIO(
176
189
  yield page
177
190
 
178
191
  def _fetch_datapoints_batch(self, batch: list[dict[str, Any]], config: Any) -> Page[DataPointListResponse] | None:
179
- responses = self.client.http_client.request_with_retries(
180
- SimpleBodyRequest(
192
+ response = self.client.http_client.request_single_retries(
193
+ RequestMessage2(
181
194
  endpoint_url=config.create_api_url("/timeseries/data/list"),
182
195
  method="POST",
183
196
  accept="application/protobuf",
@@ -185,10 +198,9 @@ class DatapointsIO(
185
198
  body_content={"items": batch}, # type: ignore[dict-item]
186
199
  )
187
200
  )
188
- first_success = next((resp for resp in responses if isinstance(resp, SuccessResponse)), None)
189
- if first_success is None:
201
+ if not isinstance(response, SuccessResponse2):
190
202
  return None
191
- data_response: DataPointListResponse = DataPointListResponse.FromString(first_success.content)
203
+ data_response: DataPointListResponse = DataPointListResponse.FromString(response.content)
192
204
  return Page("Main", [data_response])
193
205
 
194
206
  def count(self, selector: DataPointsSelector) -> int | None:
@@ -238,26 +250,26 @@ class DatapointsIO(
238
250
 
239
251
  def upload_items(
240
252
  self,
241
- data_chunk: Sequence[UploadItem[DataPointInsertionRequest]],
253
+ data_chunk: Sequence[UploadItem[DatapointsRequestAdapter]],
242
254
  http_client: HTTPClient,
243
255
  selector: DataPointsSelector | None = None,
244
- ) -> Sequence[HTTPMessage]:
245
- results: list[HTTPMessage] = []
256
+ ) -> ItemsResultList:
257
+ results = ItemsResultList()
246
258
  for item in data_chunk:
247
- response = http_client.request_with_retries(
248
- DataBodyRequest(
259
+ response = http_client.request_single_retries(
260
+ RequestMessage2(
249
261
  endpoint_url=http_client.config.create_api_url(self.UPLOAD_ENDPOINT),
250
262
  method="POST",
251
263
  content_type="application/protobuf",
252
- data_content=item.item.SerializeToString(),
264
+ data_content=item.item.datapoints.SerializeToString(),
253
265
  )
254
266
  )
255
- results.extend(response)
267
+ results.append(response.as_item_response(item.source_id))
256
268
  return results
257
269
 
258
270
  def row_to_resource(
259
271
  self, source_id: str, row: dict[str, JsonVal], selector: DataPointsSelector | None = None
260
- ) -> DataPointInsertionRequest:
272
+ ) -> DatapointsRequestAdapter:
261
273
  if selector is None:
262
274
  raise ValueError("Selector must be provided to convert row to DataPointInsertionItem.")
263
275
  # We assume that the row was read using the read_chunks method.
@@ -270,7 +282,7 @@ class DatapointsIO(
270
282
  raise RuntimeError(
271
283
  f"Unsupported selector type {type(selector).__name__} for {type(self).__name__}. Trying to transform {source_id!r} from rows to DataPointInsertionRequest."
272
284
  )
273
- return DataPointInsertionRequest(items=datapoints_items)
285
+ return DatapointsRequestAdapter(datapoints=DataPointInsertionRequest(items=datapoints_items))
274
286
 
275
287
  def _rows_to_datapoint_items_file_selector(
276
288
  self, rows: dict[str, list[Any]], selector: DataPointsFileSelector, source_id: str
@@ -406,7 +418,7 @@ class DatapointsIO(
406
418
  ).print_warning(console=self.client.console)
407
419
  self._warned_columns.add(column)
408
420
 
409
- def json_to_resource(self, item_json: dict[str, JsonVal]) -> DataPointInsertionRequest:
421
+ def json_to_resource(self, item_json: dict[str, JsonVal]) -> DatapointsRequestAdapter:
410
422
  raise ToolkitNotImplementedError(
411
423
  f"Upload of {type(DatapointsIO).__name__.removesuffix('IO')} does not support json format."
412
424
  )
@@ -1,25 +1,23 @@
1
1
  import json
2
2
  import mimetypes
3
- from collections.abc import Iterable, MutableSequence, Sequence
3
+ from collections.abc import Iterable, Sequence
4
4
  from dataclasses import dataclass
5
5
  from pathlib import Path
6
- from typing import cast
6
+ from typing import Any, cast
7
7
 
8
8
  import httpx
9
9
  from cognite.client.data_classes.data_modeling import ViewId
10
10
 
11
11
  from cognite_toolkit._cdf_tk.client import ToolkitClient
12
12
  from cognite_toolkit._cdf_tk.client.http_client import (
13
- ErrorDetails,
13
+ ErrorDetails2,
14
14
  FailedResponse2,
15
- FailedResponseItems,
16
15
  HTTPClient,
17
- HTTPMessage,
18
16
  HTTPResult2,
19
17
  RequestMessage2,
20
- SimpleBodyRequest,
21
18
  SuccessResponse2,
22
19
  )
20
+ from cognite_toolkit._cdf_tk.client.http_client._item_classes import ItemsFailedResponse2, ItemsResultList
23
21
  from cognite_toolkit._cdf_tk.client.resource_classes.data_modeling import NodeReference
24
22
  from cognite_toolkit._cdf_tk.client.resource_classes.filemetadata import FileMetadataRequest, FileMetadataResponse
25
23
  from cognite_toolkit._cdf_tk.cruds import FileMetadataCRUD
@@ -46,13 +44,12 @@ from .selectors._file_content import NodeId as SelectorNodeId
46
44
  COGNITE_FILE_VIEW = ViewId("cdf_cdm", "CogniteFile", "v1")
47
45
 
48
46
 
49
- @dataclass
50
47
  class UploadFileContentItem(UploadItem[FileMetadataRequest]):
51
48
  file_path: Path
52
49
  mime_type: str
53
50
 
54
- def dump(self) -> JsonVal:
55
- return self.item.dump(camel_case=True, exclude_extra=True)
51
+ def dump(self, camel_case: bool = True, exclude_extra: bool = True) -> dict[str, Any]:
52
+ return self.item.dump(camel_case=camel_case, exclude_extra=exclude_extra)
56
53
 
57
54
 
58
55
  @dataclass
@@ -123,8 +120,8 @@ class FileContentIO(UploadableStorageIO[FileContentSelector, MetadataWithFilePat
123
120
 
124
121
  def _retrieve_metadata(self, identifiers: Sequence[FileIdentifier]) -> Sequence[FileMetadataResponse] | None:
125
122
  config = self.client.config
126
- responses = self.client.http_client.request_with_retries(
127
- message=SimpleBodyRequest(
123
+ response = self.client.http_client.request_single_retries(
124
+ message=RequestMessage2(
128
125
  endpoint_url=config.create_api_url("/files/byids"),
129
126
  method="POST",
130
127
  body_content={
@@ -136,9 +133,13 @@ class FileContentIO(UploadableStorageIO[FileContentSelector, MetadataWithFilePat
136
133
  },
137
134
  )
138
135
  )
139
- if responses.has_failed:
136
+ if not isinstance(response, SuccessResponse2):
137
+ return None
138
+ try:
139
+ body = response.body_json
140
+ except ValueError:
140
141
  return None
141
- body = responses.get_first_body()
142
+
142
143
  items_data = body.get("items", [])
143
144
  if not isinstance(items_data, list):
144
145
  return None
@@ -182,20 +183,24 @@ class FileContentIO(UploadableStorageIO[FileContentSelector, MetadataWithFilePat
182
183
 
183
184
  def _retrieve_download_url(self, identifier: FileIdentifier) -> str | None:
184
185
  config = self.client.config
185
- responses = self.client.http_client.request_with_retries(
186
- message=SimpleBodyRequest(
186
+ response = self.client.http_client.request_single_retries(
187
+ message=RequestMessage2(
187
188
  endpoint_url=config.create_api_url("/files/downloadlink"),
188
189
  method="POST",
189
190
  body_content={"items": [identifier.model_dump(mode="json", by_alias=True, exclude={"id_type"})]},
190
191
  )
191
192
  )
193
+ if not isinstance(response, SuccessResponse2):
194
+ return None
195
+
192
196
  try:
193
- body = responses.get_first_body()
197
+ body = response.body_json
194
198
  except ValueError:
195
199
  return None
200
+
196
201
  if "items" in body and isinstance(body["items"], list) and len(body["items"]) > 0:
197
202
  # The API responses is not following the API docs, this is a workaround
198
- body = body["items"][0] # type: ignore[assignment]
203
+ body = body["items"][0]
199
204
  try:
200
205
  return cast(str, body["downloadUrl"])
201
206
  except (KeyError, IndexError):
@@ -257,8 +262,8 @@ class FileContentIO(UploadableStorageIO[FileContentSelector, MetadataWithFilePat
257
262
  data_chunk: Sequence[UploadItem[FileMetadataRequest]],
258
263
  http_client: HTTPClient,
259
264
  selector: FileContentSelector | None = None,
260
- ) -> Sequence[HTTPMessage]:
261
- results: MutableSequence[HTTPMessage] = []
265
+ ) -> ItemsResultList:
266
+ results = ItemsResultList()
262
267
  if isinstance(selector, FileMetadataTemplateSelector | FileIdentifierSelector):
263
268
  upload_url_getter = self._upload_url_asset_centric
264
269
  elif isinstance(selector, FileDataModelingTemplateSelector):
@@ -284,18 +289,17 @@ class FileContentIO(UploadableStorageIO[FileContentSelector, MetadataWithFilePat
284
289
  content_length=len(content_bytes),
285
290
  )
286
291
  )
287
- results.append(upload_response.as_item_response(item.as_id()))
292
+ results.append(upload_response.as_item_response(str(item)))
288
293
  return results
289
294
 
290
295
  def _upload_url_asset_centric(
291
- self, item: UploadFileContentItem, http_client: HTTPClient, results: MutableSequence[HTTPMessage]
296
+ self, item: UploadFileContentItem, http_client: HTTPClient, results: ItemsResultList
292
297
  ) -> str | None:
293
298
  response = http_client.request_single_retries(
294
299
  message=RequestMessage2(
295
300
  endpoint_url=http_client.config.create_api_url(self.UPLOAD_ENDPOINT),
296
301
  method="POST",
297
- # MyPy does not understand that .dump is valid json
298
- body_content=item.dump(), # type: ignore[arg-type]
302
+ body_content=item.dump(),
299
303
  )
300
304
  )
301
305
  return self._parse_upload_link_response(response, item, results)
@@ -304,7 +308,7 @@ class FileContentIO(UploadableStorageIO[FileContentSelector, MetadataWithFilePat
304
308
  self,
305
309
  item: UploadFileContentItem,
306
310
  http_client: HTTPClient,
307
- results: MutableSequence[HTTPMessage],
311
+ results: ItemsResultList,
308
312
  created_node: bool = False,
309
313
  ) -> str | None:
310
314
  """Get upload URL for data modeling file upload.
@@ -333,7 +337,7 @@ class FileContentIO(UploadableStorageIO[FileContentSelector, MetadataWithFilePat
333
337
  )
334
338
  )
335
339
  if isinstance(response, FailedResponse2) and response.error.missing and not created_node:
336
- if self._create_cognite_file_node(instance_id, http_client, item.as_id(), results):
340
+ if self._create_cognite_file_node(instance_id, http_client, item.source_id, results):
337
341
  return self._upload_url_data_modeling(item, http_client, results, created_node=True)
338
342
  else:
339
343
  return None
@@ -342,7 +346,7 @@ class FileContentIO(UploadableStorageIO[FileContentSelector, MetadataWithFilePat
342
346
 
343
347
  @classmethod
344
348
  def _create_cognite_file_node(
345
- cls, instance_id: NodeReference, http_client: HTTPClient, upload_id: str, results: MutableSequence[HTTPMessage]
349
+ cls, instance_id: NodeReference, http_client: HTTPClient, upload_id: str, results: ItemsResultList
346
350
  ) -> bool:
347
351
  node_creation = http_client.request_single_retries(
348
352
  message=RequestMessage2(
@@ -368,25 +372,25 @@ class FileContentIO(UploadableStorageIO[FileContentSelector, MetadataWithFilePat
368
372
  if isinstance(node_creation, SuccessResponse2):
369
373
  # Node created successfully
370
374
  return True
371
- results.append(node_creation.as_item_response(instance_id))
375
+ results.append(node_creation.as_item_response(upload_id))
372
376
  return False
373
377
 
374
378
  @classmethod
375
379
  def _parse_upload_link_response(
376
- cls, response: HTTPResult2, item: UploadFileContentItem, results: MutableSequence[HTTPMessage]
380
+ cls, response: HTTPResult2, item: UploadFileContentItem, results: ItemsResultList
377
381
  ) -> str | None:
378
382
  if not isinstance(response, SuccessResponse2):
379
- results.append(response.as_item_response(item.as_id()))
383
+ results.append(response.as_item_response(item.source_id))
380
384
  return None
381
385
  try:
382
386
  body = response.body_json
383
387
  except ValueError:
384
388
  results.append(
385
- FailedResponseItems(
389
+ ItemsFailedResponse2(
386
390
  status_code=response.status_code,
387
391
  body=response.body,
388
- error=ErrorDetails(code=response.status_code, message="Invalid JSON response"),
389
- ids=[item.as_id()],
392
+ error=ErrorDetails2(code=response.status_code, message="Invalid JSON response"),
393
+ ids=[item.source_id],
390
394
  )
391
395
  )
392
396
  return None
@@ -396,11 +400,11 @@ class FileContentIO(UploadableStorageIO[FileContentSelector, MetadataWithFilePat
396
400
  upload_url = cast(str, body["uploadUrl"])
397
401
  except (KeyError, IndexError):
398
402
  results.append(
399
- FailedResponseItems(
403
+ ItemsFailedResponse2(
400
404
  status_code=200,
401
405
  body=json.dumps(body),
402
- error=ErrorDetails(code=200, message="Malformed response"),
403
- ids=[item.as_id()],
406
+ error=ErrorDetails2(code=200, message="Malformed response"),
407
+ ids=[item.source_id],
404
408
  )
405
409
  )
406
410
  return None
@@ -4,7 +4,8 @@ from uuid import uuid4
4
4
 
5
5
  from cognite.client.data_classes import Row, RowWrite
6
6
 
7
- from cognite_toolkit._cdf_tk.client.http_client import HTTPClient, HTTPMessage, ItemsRequest
7
+ from cognite_toolkit._cdf_tk.client.http_client import HTTPClient
8
+ from cognite_toolkit._cdf_tk.client.http_client._item_classes import ItemsRequest2, ItemsResultList
8
9
  from cognite_toolkit._cdf_tk.cruds import RawDatabaseCRUD, RawTableCRUD
9
10
  from cognite_toolkit._cdf_tk.exceptions import ToolkitValueError
10
11
  from cognite_toolkit._cdf_tk.utils import sanitize_filename
@@ -60,16 +61,16 @@ class RawIO(
60
61
  data_chunk: Sequence[UploadItem[RowWrite]],
61
62
  http_client: HTTPClient,
62
63
  selector: RawTableSelector | None = None,
63
- ) -> Sequence[HTTPMessage]:
64
+ ) -> ItemsResultList:
64
65
  if selector is None:
65
66
  raise ToolkitValueError("Selector must be provided for RawIO upload_items")
66
67
  url = self.UPLOAD_ENDPOINT.format(dbName=selector.table.db_name, tableName=selector.table.table_name)
67
68
  config = http_client.config
68
- return http_client.request_with_retries(
69
- message=ItemsRequest(
69
+ return http_client.request_items_retries(
70
+ message=ItemsRequest2(
70
71
  endpoint_url=config.create_api_url(url),
71
72
  method="POST",
72
- items=list(data_chunk),
73
+ items=data_chunk,
73
74
  )
74
75
  )
75
76
 
@@ -12,7 +12,7 @@ jobs:
12
12
  environment: dev
13
13
  name: Deploy
14
14
  container:
15
- image: cognite/toolkit:0.7.55
15
+ image: cognite/toolkit:0.7.56
16
16
  env:
17
17
  CDF_CLUSTER: ${{ vars.CDF_CLUSTER }}
18
18
  CDF_PROJECT: ${{ vars.CDF_PROJECT }}
@@ -10,7 +10,7 @@ jobs:
10
10
  environment: dev
11
11
  name: Deploy Dry Run
12
12
  container:
13
- image: cognite/toolkit:0.7.55
13
+ image: cognite/toolkit:0.7.56
14
14
  env:
15
15
  CDF_CLUSTER: ${{ vars.CDF_CLUSTER }}
16
16
  CDF_PROJECT: ${{ vars.CDF_PROJECT }}
@@ -4,7 +4,7 @@ default_env = "<DEFAULT_ENV_PLACEHOLDER>"
4
4
  [modules]
5
5
  # This is the version of the modules. It should not be changed manually.
6
6
  # It will be updated by the 'cdf modules upgrade' command.
7
- version = "0.7.55"
7
+ version = "0.7.56"
8
8
 
9
9
 
10
10
  [plugins]
@@ -1 +1 @@
1
- __version__ = "0.7.55"
1
+ __version__ = "0.7.56"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite_toolkit
3
- Version: 0.7.55
3
+ Version: 0.7.56
4
4
  Summary: Official Cognite Data Fusion tool for project templates and configuration deployment
5
5
  Author: Cognite AS
6
6
  Author-email: Cognite AS <support@cognite.com>
@@ -109,10 +109,9 @@ cognite_toolkit/_cdf_tk/client/cdf_client/__init__.py,sha256=jTu-l5BjBWOyQdhYMk9
109
109
  cognite_toolkit/_cdf_tk/client/cdf_client/api.py,sha256=QaL5P3HyyI51j3xprm02K0Pc-tEaJqywXs7IeVIwggk,14547
110
110
  cognite_toolkit/_cdf_tk/client/cdf_client/responses.py,sha256=UVhvU_8UKCLsjCFaSiVFF6uk72pHOx87ZLk88dhuOYk,1050
111
111
  cognite_toolkit/_cdf_tk/client/config.py,sha256=weMR43z-gqHMn-Jqvfmh_nJ0HbgEdyeCGtISuEf3OuY,4269
112
- cognite_toolkit/_cdf_tk/client/http_client/__init__.py,sha256=-RNm4iXlNX9f_JLW4QKXiet7LrWotCE36ZOlIqyhZT8,1504
113
- cognite_toolkit/_cdf_tk/client/http_client/_client.py,sha256=a9ZcW46Ht5mt7wtJJH_ty34E9IxUJTv1NY0xclNUeCg,22752
114
- cognite_toolkit/_cdf_tk/client/http_client/_data_classes.py,sha256=c-Uau6qOi5TLM5cPE84CkTfrKB_dGhoYHWLXSEOo5AM,15438
115
- cognite_toolkit/_cdf_tk/client/http_client/_data_classes2.py,sha256=2aV1pmwBxyuUnEYoNr294GnZSykGH3hQyfMyjE-9hq4,5439
112
+ cognite_toolkit/_cdf_tk/client/http_client/__init__.py,sha256=Z4p6Zn5SUo6NdqXEBDNGdM3RLATab_fG3dZkSQdrA0I,697
113
+ cognite_toolkit/_cdf_tk/client/http_client/_client.py,sha256=UvN_2Dg4BS0BiXDi3-Yxw1MSeG63Xq748kbjCIVylVs,15946
114
+ cognite_toolkit/_cdf_tk/client/http_client/_data_classes2.py,sha256=xuPpOT8UjCUFmj-Hq6tQ0Eh8VCPhcnbUNtMYbLPTYgE,5442
116
115
  cognite_toolkit/_cdf_tk/client/http_client/_exception.py,sha256=9dE5tm1qTviG93JppLql6ltlmAgm8TxWh9wWPdm0ITA,428
117
116
  cognite_toolkit/_cdf_tk/client/http_client/_item_classes.py,sha256=BRilwk05WTHoM03DifyUBQx-4-OHIHp8gOoQPh1zNBg,4474
118
117
  cognite_toolkit/_cdf_tk/client/http_client/_tracker.py,sha256=pu6oA-XpOeaOLdoeD_mGfJXC3BFGWfh5oGcRDpb6maw,1407
@@ -142,7 +141,7 @@ cognite_toolkit/_cdf_tk/client/resource_classes/data_modeling/_view_property.py,
142
141
  cognite_toolkit/_cdf_tk/client/resource_classes/dataset.py,sha256=OAddeyFdbJSyuOBHiqPYWl6L5eJTG64l05Lx0LOoZxM,1022
143
142
  cognite_toolkit/_cdf_tk/client/resource_classes/event.py,sha256=nnqxqEzhRmo-dqKrAgflbz7kRxIhEHo8fdPxCvsjq4U,1223
144
143
  cognite_toolkit/_cdf_tk/client/resource_classes/extraction_pipeline.py,sha256=VG9PgX1C5du_iTFy4k_vUvrpYzlYxa2-nbyM9wcNGf0,1732
145
- cognite_toolkit/_cdf_tk/client/resource_classes/filemetadata.py,sha256=1s16bgWwadl-NmK_kwVmqU08u1T7V9SnxQQtygDqnPo,2132
144
+ cognite_toolkit/_cdf_tk/client/resource_classes/filemetadata.py,sha256=wsnZ91lzEvoXI_6LeusuTQMExFAUU3FWCqjsvRkaHd8,2356
146
145
  cognite_toolkit/_cdf_tk/client/resource_classes/function.py,sha256=LRwiS4LHrjBEn9HnsD2SJhejGCzDdf_GPEkhwRxxbwc,1657
147
146
  cognite_toolkit/_cdf_tk/client/resource_classes/function_schedule.py,sha256=_rUgayCIdrhSOiifsqg_78heyswOk4TCUPPBAjpxHfY,1994
148
147
  cognite_toolkit/_cdf_tk/client/resource_classes/graphql_data_model.py,sha256=Us21oW8mlOUqNKiBqCqSI6kclaINOQe8ZzNXrLnxYBw,1212
@@ -223,7 +222,7 @@ cognite_toolkit/_cdf_tk/commands/_cli_commands.py,sha256=TK6U_rm6VZT_V941kTyHMou
223
222
  cognite_toolkit/_cdf_tk/commands/_download.py,sha256=dVddH9t7oGx1kdQ3CCYYQb96Uxxy-xC8Opph98lo46U,6869
224
223
  cognite_toolkit/_cdf_tk/commands/_import_cmd.py,sha256=RkJ7RZI6zxe0_1xrPB-iJhCVchurmIAChilx0_XMR6k,11141
225
224
  cognite_toolkit/_cdf_tk/commands/_migrate/__init__.py,sha256=8ki04tJGH1dHdF2NtVF4HyhaC0XDDS7onrH_nvd9KtE,153
226
- cognite_toolkit/_cdf_tk/commands/_migrate/command.py,sha256=S5ZB7POjJ2ue3D54kW8TZLFuRJAilqwlLlELu3HGEMM,13579
225
+ cognite_toolkit/_cdf_tk/commands/_migrate/command.py,sha256=wNYtOUiPQWWJoDRoLVSU-YZqFUSsbfVgDW_DRZPw4yc,13595
227
226
  cognite_toolkit/_cdf_tk/commands/_migrate/conversion.py,sha256=-sZktmsDIqkhNg-kg95Ty6eTm7FiyFRi1ZQLOkZ5x2w,17889
228
227
  cognite_toolkit/_cdf_tk/commands/_migrate/creators.py,sha256=Gp3CKruTxeSDS3HiWiLsQ4mN2SZ4BQB5xQ50o68GTs8,9616
229
228
  cognite_toolkit/_cdf_tk/commands/_migrate/data_classes.py,sha256=4hv_TKTfEZoC9h6lIlAW_ewKlT6F4KrquQpqUz8M1iw,11679
@@ -231,13 +230,13 @@ cognite_toolkit/_cdf_tk/commands/_migrate/data_mapper.py,sha256=qHYeFCBBGPejbgC_
231
230
  cognite_toolkit/_cdf_tk/commands/_migrate/data_model.py,sha256=0lRyDRJ8zo00OngwWagQgHQIaemK4eufW9kbWwZ9Yo0,7901
232
231
  cognite_toolkit/_cdf_tk/commands/_migrate/default_mappings.py,sha256=nH_wC0RzcI721sXwH_pThOxPv1nq4-oBd1rCDSGbr9Y,5555
233
232
  cognite_toolkit/_cdf_tk/commands/_migrate/issues.py,sha256=SFkfLBCLI4nZBIWSRnyu6G4xcdS-csYJwzmzc4Jmzho,6988
234
- cognite_toolkit/_cdf_tk/commands/_migrate/migration_io.py,sha256=ZrmI_jx6sf7G027-G9arVjtr0DyUn8onUAMmsEFn67E,26798
233
+ cognite_toolkit/_cdf_tk/commands/_migrate/migration_io.py,sha256=bJhBL8LNpvO4paksut6DupBFHwKKmNruTi9mmygDUQI,26826
235
234
  cognite_toolkit/_cdf_tk/commands/_migrate/prepare.py,sha256=RfqaNoso5CyBwc-p6ckwcYqBfZXKhdJgdGIyd0TATaI,2635
236
235
  cognite_toolkit/_cdf_tk/commands/_migrate/selectors.py,sha256=N1H_-rBpPUD6pbrlcofn1uEK1bA694EUXEe1zIXeqyo,2489
237
236
  cognite_toolkit/_cdf_tk/commands/_profile.py,sha256=CQthu52V2Lyi8nbqNHqjyiKnIHLWfK7GNZ5A0SlaI-Y,43138
238
- cognite_toolkit/_cdf_tk/commands/_purge.py,sha256=l_5kU0trNTOUc_kbclHL-o4cyNlRdB7valnvMCseR6w,32853
237
+ cognite_toolkit/_cdf_tk/commands/_purge.py,sha256=hOLPl9hz723rUzGHRk9iaZe8yDmrK84ZgzUBiCh3fn0,33009
239
238
  cognite_toolkit/_cdf_tk/commands/_questionary_style.py,sha256=h-w7fZKkGls3TrzIGBKjsZSGoXJJIYchgD1StfA40r8,806
240
- cognite_toolkit/_cdf_tk/commands/_upload.py,sha256=ncI1XIKRsqLzCPFS6twsKwKdpcrS6QKwzQpC8-uv0X4,13041
239
+ cognite_toolkit/_cdf_tk/commands/_upload.py,sha256=jsEHm1AiR04CuZPz43M4PfrlT0n6OU4cWbeNfGqEhxI,13050
241
240
  cognite_toolkit/_cdf_tk/commands/_utils.py,sha256=UxMJW5QYKts4om5n6x2Tq2ihvfO9gWjhQKeqZNFTlKg,402
242
241
  cognite_toolkit/_cdf_tk/commands/_virtual_env.py,sha256=GFAid4hplixmj9_HkcXqU5yCLj-fTXm4cloGD6U2swY,2180
243
242
  cognite_toolkit/_cdf_tk/commands/about.py,sha256=pEXNdCeJYONOalH8x-7QRsKLgj-9gdIqN16pPxA3bhg,9395
@@ -309,7 +308,7 @@ cognite_toolkit/_cdf_tk/exceptions.py,sha256=xG0jMwi5A20nvPvyo6sCyz_cyKycynPyIzp
309
308
  cognite_toolkit/_cdf_tk/feature_flags.py,sha256=YjhssJBqJlBTjNFEwskjHv1ub1GyoP6NsON6ucNicyM,2533
310
309
  cognite_toolkit/_cdf_tk/hints.py,sha256=UI1ymi2T5wCcYOpEbKbVaDnlyFReFy8TDtMVt-5E1h8,6493
311
310
  cognite_toolkit/_cdf_tk/plugins.py,sha256=0V14rceAWLZQF8iWdyL5QmK7xB796YaDEtb9RIj5AOc,836
312
- cognite_toolkit/_cdf_tk/protocols.py,sha256=Lc8XnBfmDZN6dwmSopmK7cFE9a9jZ2zdUryEeCXn27I,3052
311
+ cognite_toolkit/_cdf_tk/protocols.py,sha256=Mmehp93i-FA8uRnNcUpReYG_aB89SlsoZhbakyXz21Q,3109
313
312
  cognite_toolkit/_cdf_tk/resource_classes/__init__.py,sha256=SKNqqKMWk6vnuYPB7Bbl2CrKwoAxZ_qu8doaA6ULwZc,4080
314
313
  cognite_toolkit/_cdf_tk/resource_classes/agent.py,sha256=5rglrj551Z-0eT53S_UmSA3wz4m4Y494QxleWVs0ECE,1786
315
314
  cognite_toolkit/_cdf_tk/resource_classes/agent_tools.py,sha256=oNkpPCQF3CyV9zcD6NTuEAnATLXzslw2GOyFz58ZGZg,2891
@@ -370,14 +369,14 @@ cognite_toolkit/_cdf_tk/resource_classes/workflow_trigger.py,sha256=aSN0WFPupQ38
370
369
  cognite_toolkit/_cdf_tk/resource_classes/workflow_version.py,sha256=ZCn7xJyTEQCjWbvceny6yJYhqFcS64LbR228dbGjLXI,10195
371
370
  cognite_toolkit/_cdf_tk/storageio/__init__.py,sha256=h5Wr4i7zNIgsslrsRJxmp7ls4bNRKl0uZzQ7GLRMP7g,1920
372
371
  cognite_toolkit/_cdf_tk/storageio/_annotations.py,sha256=QcFrikDgz-9VjNy4Xq7wchM4VOQh-z2JaHcWR2C1sEs,4879
373
- cognite_toolkit/_cdf_tk/storageio/_applications.py,sha256=8XYcXHnrshxw0wB6ehtbiVZXgQxx-ci7czmUbwP-tXE,21338
372
+ cognite_toolkit/_cdf_tk/storageio/_applications.py,sha256=u3J9zixYcvHStIW8Df0EUYriXQdQS71ox0n3Zrg5A4Q,21396
374
373
  cognite_toolkit/_cdf_tk/storageio/_asset_centric.py,sha256=IM17Ouq-5ozbvr6LbE6-fiijorHUV734VRj7S2JjbJw,32822
375
- cognite_toolkit/_cdf_tk/storageio/_base.py,sha256=EBAueJQBSkMShRCt5PYoscGAxOeKuQEteG5lSEFrXf0,13158
374
+ cognite_toolkit/_cdf_tk/storageio/_base.py,sha256=bs6iWPN80kY75gSlrMyDpe8HKtNRGEWvvSUdgHrzmVg,13461
376
375
  cognite_toolkit/_cdf_tk/storageio/_data_classes.py,sha256=s3TH04BJ1q7rXndRhEbVMEnoOXjxrGg4n-w9Z5uUL-o,3480
377
- cognite_toolkit/_cdf_tk/storageio/_datapoints.py,sha256=sgO5TAD87gHn8gxTwRM3yn__yVDsOrNR_MDoOpZwcUg,20207
378
- cognite_toolkit/_cdf_tk/storageio/_file_content.py,sha256=Flfh2yekYQQKjx9TKclQ6LvaifZlDAK2PNLFGgBhfuo,19408
376
+ cognite_toolkit/_cdf_tk/storageio/_datapoints.py,sha256=ZAfsjeXjmZ96-ranQgynJcMOnbVlzWXhxpM-eCPG8hE,20755
377
+ cognite_toolkit/_cdf_tk/storageio/_file_content.py,sha256=5Az-oWHV77SS_44Nb4PAmORgdbsb4JBh6-yeAKhZf3U,19469
379
378
  cognite_toolkit/_cdf_tk/storageio/_instances.py,sha256=2mb9nTC63cn3r1B9YqA0wAmHcbJhMDiET78T7XY5Yco,10821
380
- cognite_toolkit/_cdf_tk/storageio/_raw.py,sha256=VqzAF79ON3hjrVRTBsSiSGK9B_Xmm-PWhFxvA0YKgPE,5162
379
+ cognite_toolkit/_cdf_tk/storageio/_raw.py,sha256=AvGmMySZ3ENN5X8EnwORVXqaF4E4fmGcx0PIJRLLSyg,5225
381
380
  cognite_toolkit/_cdf_tk/storageio/logger.py,sha256=RDQvauxSjtlVX-V5XGkFCtqiWpv4KdjJrEcPFVNqPF0,5557
382
381
  cognite_toolkit/_cdf_tk/storageio/selectors/__init__.py,sha256=5qqgeCrsmMLVsrRuYKxCKq1bNnvJkWeAsATpTKN1eC4,4394
383
382
  cognite_toolkit/_cdf_tk/storageio/selectors/_asset_centric.py,sha256=7Iv_ccVX6Vzt3ZLFZ0Er3hN92iEsFTm9wgF-yermOWE,1467
@@ -432,14 +431,14 @@ cognite_toolkit/_repo_files/.gitignore,sha256=ip9kf9tcC5OguF4YF4JFEApnKYw0nG0vPi
432
431
  cognite_toolkit/_repo_files/AzureDevOps/.devops/README.md,sha256=OLA0D7yCX2tACpzvkA0IfkgQ4_swSd-OlJ1tYcTBpsA,240
433
432
  cognite_toolkit/_repo_files/AzureDevOps/.devops/deploy-pipeline.yml,sha256=brULcs8joAeBC_w_aoWjDDUHs3JheLMIR9ajPUK96nc,693
434
433
  cognite_toolkit/_repo_files/AzureDevOps/.devops/dry-run-pipeline.yml,sha256=OBFDhFWK1mlT4Dc6mDUE2Es834l8sAlYG50-5RxRtHk,723
435
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=wlw8bzAuu9ZAieHeMewahigPiZrgN2CvwG0Fh1BPxJI,667
436
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=7ElwZZm3FtE94ufacJahiWdu0hn6n2-ZqswDVUlyQQA,2430
437
- cognite_toolkit/_resources/cdf.toml,sha256=Ycd_4drXiMNcukd90evjif7IW9TqE66U8VXingpuJqE,475
438
- cognite_toolkit/_version.py,sha256=mm-_iZbLGXQnLJQ926cH2bSU58VrvcnGbT2jQrV9Yno,23
434
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=2i9Ng74EywCNtMWB3p6RH_ougZxhuXyep_kg3eDKrVA,667
435
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=rKeaGepihOXaQpyMBo34JBKvsEdNxmy-jYhakfETD14,2430
436
+ cognite_toolkit/_resources/cdf.toml,sha256=Y90ZeHswQtBDSZOwQY5fIgKxG5J-3CouSwkdgAxF4lA,475
437
+ cognite_toolkit/_version.py,sha256=T4f8KhXLIFbit-GdCb09Sz4JRKr4HXaM2f5YW5zmzJo,23
439
438
  cognite_toolkit/config.dev.yaml,sha256=M33FiIKdS3XKif-9vXniQ444GTZ-bLXV8aFH86u9iUQ,332
440
439
  cognite_toolkit/demo/__init__.py,sha256=-m1JoUiwRhNCL18eJ6t7fZOL7RPfowhCuqhYFtLgrss,72
441
440
  cognite_toolkit/demo/_base.py,sha256=6xKBUQpXZXGQ3fJ5f7nj7oT0s2n7OTAGIa17ZlKHZ5U,8052
442
- cognite_toolkit-0.7.55.dist-info/WHEEL,sha256=e_m4S054HL0hyR3CpOk-b7Q7fDX6BuFkgL5OjAExXas,80
443
- cognite_toolkit-0.7.55.dist-info/entry_points.txt,sha256=EtZ17K2mUjh-AY0QNU1CPIB_aDSSOdmtNI_4Fj967mA,84
444
- cognite_toolkit-0.7.55.dist-info/METADATA,sha256=WB8pDDsfKoQGUsGye-k20d2JUJYj6QJBcftshus0u7c,5026
445
- cognite_toolkit-0.7.55.dist-info/RECORD,,
441
+ cognite_toolkit-0.7.56.dist-info/WHEEL,sha256=e_m4S054HL0hyR3CpOk-b7Q7fDX6BuFkgL5OjAExXas,80
442
+ cognite_toolkit-0.7.56.dist-info/entry_points.txt,sha256=EtZ17K2mUjh-AY0QNU1CPIB_aDSSOdmtNI_4Fj967mA,84
443
+ cognite_toolkit-0.7.56.dist-info/METADATA,sha256=sezNguEqp_kSwhuDxIxI1DZ21sqLAGlxFCS8wjGWj7U,5026
444
+ cognite_toolkit-0.7.56.dist-info/RECORD,,