cognite-toolkit 0.7.8__py3-none-any.whl → 0.7.9__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,4 +1,5 @@
1
1
  from collections.abc import Iterable, Sequence
2
+ from itertools import chain
2
3
  from uuid import uuid4
3
4
 
4
5
  from cognite.client.data_classes import Row, RowWrite
@@ -6,6 +7,8 @@ from cognite.client.data_classes import Row, RowWrite
6
7
  from cognite_toolkit._cdf_tk.cruds import RawDatabaseCRUD, RawTableCRUD
7
8
  from cognite_toolkit._cdf_tk.exceptions import ToolkitValueError
8
9
  from cognite_toolkit._cdf_tk.utils import sanitize_filename
10
+ from cognite_toolkit._cdf_tk.utils.collection import chunker
11
+ from cognite_toolkit._cdf_tk.utils.fileio import MultiFileReader
9
12
  from cognite_toolkit._cdf_tk.utils.http_client import HTTPClient, HTTPMessage, ItemsRequest
10
13
  from cognite_toolkit._cdf_tk.utils.useful_types import JsonVal
11
14
 
@@ -96,3 +99,26 @@ class RawIO(
96
99
  if selector is not None and selector.key is not None and selector.key in row:
97
100
  key = str(row.pop(selector.key))
98
101
  return RowWrite(key=key, columns=row)
102
+
103
+ @classmethod
104
+ def read_chunks(
105
+ cls, reader: MultiFileReader, selector: RawTableSelector
106
+ ) -> Iterable[list[tuple[str, dict[str, JsonVal]]]]:
107
+ if not reader.is_table or selector.key is None:
108
+ yield from super().read_chunks(reader, selector)
109
+ return
110
+ data_name = "row" if reader.is_table else "line"
111
+ # Validate that the key exists in all files
112
+ for input_file in sorted(reader.input_files, key=reader._part_no):
113
+ iterable = reader.reader_class(input_file).read_chunks()
114
+ try:
115
+ first = next(iterable)
116
+ except StopIteration:
117
+ continue
118
+ if selector.key not in first:
119
+ raise ToolkitValueError(
120
+ f"Column '{selector.key}' not found in file {input_file.as_posix()!r}. Please ensure the specified column exists."
121
+ )
122
+ full_iterator = chain([first], iterable)
123
+ line_numbered_iterator = ((f"{data_name} {i}", row) for i, row in enumerate(full_iterator, start=1))
124
+ yield from chunker(line_numbered_iterator, cls.CHUNK_SIZE)
@@ -12,7 +12,7 @@ jobs:
12
12
  environment: dev
13
13
  name: Deploy
14
14
  container:
15
- image: cognite/toolkit:0.7.8
15
+ image: cognite/toolkit:0.7.9
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.8
13
+ image: cognite/toolkit:0.7.9
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.8"
7
+ version = "0.7.9"
8
8
 
9
9
 
10
10
  [plugins]
@@ -1 +1 @@
1
- __version__ = "0.7.8"
1
+ __version__ = "0.7.9"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite_toolkit
3
- Version: 0.7.8
3
+ Version: 0.7.9
4
4
  Summary: Official Cognite Data Fusion tool for project templates and configuration deployment
5
5
  Project-URL: Homepage, https://docs.cognite.com/cdf/deploy/cdf_toolkit/
6
6
  Project-URL: Changelog, https://github.com/cognitedata/toolkit/releases
@@ -1,6 +1,6 @@
1
1
  cognite_toolkit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  cognite_toolkit/_cdf.py,sha256=PzDig6dgbDX5VL88AeijQuTeYb2SS_yvenw9gr4fnxY,5794
3
- cognite_toolkit/_version.py,sha256=uC8wB9mRblQ0jUBAOUyCQLUQJ39MC2xybVLB_8ZsevU,22
3
+ cognite_toolkit/_version.py,sha256=Plj3sh67uLqQt2X1uejJ0B3ggLdj4Fr1HPHcgyqtneU,22
4
4
  cognite_toolkit/_cdf_tk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  cognite_toolkit/_cdf_tk/cdf_toml.py,sha256=VSWV9h44HusWIaKpWgjrOMrc3hDoPTTXBXlp6-NOrIM,9079
6
6
  cognite_toolkit/_cdf_tk/constants.py,sha256=TplKm2J9pGRHq7nAnLI0caTMHetS04OIz3hfq-jvGzo,7236
@@ -249,7 +249,7 @@ cognite_toolkit/_cdf_tk/storageio/_data_classes.py,sha256=s3TH04BJ1q7rXndRhEbVME
249
249
  cognite_toolkit/_cdf_tk/storageio/_datapoints.py,sha256=AGTQm9CBRbu1oXbBh0X7UGzFrHnlWZExqNvAohT0hM0,8641
250
250
  cognite_toolkit/_cdf_tk/storageio/_file_content.py,sha256=g8HDDHbBPBcb3g6Zp-vHc8uvNZYrZXWs5G0jq_eOc4w,10884
251
251
  cognite_toolkit/_cdf_tk/storageio/_instances.py,sha256=t9fNpHnT6kCk8LDoPj3qZXmHpyDbPF5BZ6pI8ziTyFw,10810
252
- cognite_toolkit/_cdf_tk/storageio/_raw.py,sha256=5WjAFiVR0KKRhMqCy1IRy1TQFWj86D7nGu5WSFNLp6U,3869
252
+ cognite_toolkit/_cdf_tk/storageio/_raw.py,sha256=pgZN5MbqDwMZl9Ow1KouDJUO2Ngga8_b6hwv7H31SVQ,5161
253
253
  cognite_toolkit/_cdf_tk/storageio/selectors/__init__.py,sha256=ELUCirQmhDR52PVIhLRd_2M1DWYURwL44U6WiN9_hEA,2225
254
254
  cognite_toolkit/_cdf_tk/storageio/selectors/_asset_centric.py,sha256=7Iv_ccVX6Vzt3ZLFZ0Er3hN92iEsFTm9wgF-yermOWE,1467
255
255
  cognite_toolkit/_cdf_tk/storageio/selectors/_base.py,sha256=hjFkbmNGsK3QIW-jnJV_8YNmvVROERxzG82qIZhU7SM,3065
@@ -303,13 +303,13 @@ cognite_toolkit/_repo_files/.gitignore,sha256=ip9kf9tcC5OguF4YF4JFEApnKYw0nG0vPi
303
303
  cognite_toolkit/_repo_files/AzureDevOps/.devops/README.md,sha256=OLA0D7yCX2tACpzvkA0IfkgQ4_swSd-OlJ1tYcTBpsA,240
304
304
  cognite_toolkit/_repo_files/AzureDevOps/.devops/deploy-pipeline.yml,sha256=brULcs8joAeBC_w_aoWjDDUHs3JheLMIR9ajPUK96nc,693
305
305
  cognite_toolkit/_repo_files/AzureDevOps/.devops/dry-run-pipeline.yml,sha256=OBFDhFWK1mlT4Dc6mDUE2Es834l8sAlYG50-5RxRtHk,723
306
- cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=L55NhSDSUlxT5pZbTRphvOlO0MvCiuWXkNsGq4q7Bn4,666
307
- cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=9i3QNPhYewexcukRhRUaXIFh8Xgd4k8XxTiFWKxyD64,2429
308
- cognite_toolkit/_resources/cdf.toml,sha256=TN3TRIdZo6zfKthRLj0JW7VatUQ_pLeKUktmm2zl_1E,474
306
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/deploy.yaml,sha256=1_fEjrhRKAHXIqLW4lBT6JS9GmVbyIxZFK1tYku7RA0,666
307
+ cognite_toolkit/_repo_files/GitHub/.github/workflows/dry-run.yaml,sha256=3yRJMs7Um0M9HikqM8RlGbnVK7jqdJyEgZrbkfIqMHc,2429
308
+ cognite_toolkit/_resources/cdf.toml,sha256=3vbfRsbDoAwloTprZxOV1lEmobT1VXoNAHniNXimJkI,474
309
309
  cognite_toolkit/demo/__init__.py,sha256=-m1JoUiwRhNCL18eJ6t7fZOL7RPfowhCuqhYFtLgrss,72
310
310
  cognite_toolkit/demo/_base.py,sha256=6xKBUQpXZXGQ3fJ5f7nj7oT0s2n7OTAGIa17ZlKHZ5U,8052
311
- cognite_toolkit-0.7.8.dist-info/METADATA,sha256=LCh--Lkkr8NwKHeApUv_HfSm_9p2e1wuMQnMmP76zYQ,4500
312
- cognite_toolkit-0.7.8.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
313
- cognite_toolkit-0.7.8.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
314
- cognite_toolkit-0.7.8.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
315
- cognite_toolkit-0.7.8.dist-info/RECORD,,
311
+ cognite_toolkit-0.7.9.dist-info/METADATA,sha256=dCFxCZZyD0iS8h4oBEWmWX7DuM7e9r8iIop0eSha7eY,4500
312
+ cognite_toolkit-0.7.9.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
313
+ cognite_toolkit-0.7.9.dist-info/entry_points.txt,sha256=JlR7MH1_UMogC3QOyN4-1l36VbrCX9xUdQoHGkuJ6-4,83
314
+ cognite_toolkit-0.7.9.dist-info/licenses/LICENSE,sha256=CW0DRcx5tL-pCxLEN7ts2S9g2sLRAsWgHVEX4SN9_Mc,752
315
+ cognite_toolkit-0.7.9.dist-info/RECORD,,