airbyte-cdk 6.45.0.dev4100__py3-none-any.whl → 6.45.0.dev4102__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.
@@ -8,7 +8,7 @@ from datetime import datetime
8
8
  from enum import Enum
9
9
  from io import IOBase
10
10
  from os import makedirs, path
11
- from typing import Iterable, List, Optional, Set, Tuple
11
+ from typing import Any, Iterable, List, Optional, Set, Tuple, MutableMapping
12
12
 
13
13
  from wcmatch.glob import GLOBSTAR, globmatch
14
14
 
@@ -30,6 +30,12 @@ class FileReadMode(Enum):
30
30
 
31
31
  class AbstractFileBasedStreamReader(ABC):
32
32
  DATE_TIME_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
33
+ FILE_RELATIVE_PATH = "file_relative_path"
34
+ FILE_NAME = "file_name"
35
+ LOCAL_FILE_PATH = "local_file_path"
36
+ ABSOLUTE_FILE_PATH = "absolute_file_path"
37
+ SOURCE_FILE_URI = "source_file_relative_path"
38
+ FILE_FOLDER = "file_folder"
33
39
 
34
40
  def __init__(self) -> None:
35
41
  self._config = None
@@ -171,16 +177,28 @@ class AbstractFileBasedStreamReader(ABC):
171
177
  """
172
178
  ...
173
179
 
174
- def _get_file_transfer_paths(self, file: RemoteFile, local_directory: str) -> List[str]:
180
+ def _get_file_transfer_paths(self, file: RemoteFile, local_directory: str) -> MutableMapping[str, Any]:
175
181
  preserve_directory_structure = self.preserve_directory_structure()
182
+ file_uri = file.uri
183
+ file_name = path.basename(file_uri)
184
+ file_folder = path.dirname(file_uri)
176
185
  if preserve_directory_structure:
177
186
  # Remove left slashes from source path format to make relative path for writing locally
178
- file_relative_path = file.uri.lstrip("/")
187
+ file_relative_path = file_uri.lstrip("/")
179
188
  else:
180
- file_relative_path = path.basename(file.uri)
189
+ file_relative_path = file_name
181
190
  local_file_path = path.join(local_directory, file_relative_path)
182
-
183
191
  # Ensure the local directory exists
184
192
  makedirs(path.dirname(local_file_path), exist_ok=True)
185
193
  absolute_file_path = path.abspath(local_file_path)
186
- return [file_relative_path, local_file_path, absolute_file_path]
194
+
195
+ file_paths = {
196
+ self.FILE_RELATIVE_PATH: file_relative_path,
197
+ self.LOCAL_FILE_PATH: local_file_path,
198
+ self.ABSOLUTE_FILE_PATH: absolute_file_path,
199
+ self.FILE_NAME: file_name,
200
+ self.FILE_FOLDER: file_folder,
201
+ self.SOURCE_FILE_URI: file_uri,
202
+
203
+ }
204
+ return file_paths
@@ -4,7 +4,7 @@
4
4
 
5
5
  import copy
6
6
  import logging
7
- from functools import cache, lru_cache
7
+ from functools import lru_cache
8
8
  from typing import TYPE_CHECKING, Any, Iterable, List, Mapping, MutableMapping, Optional, Union
9
9
 
10
10
  from typing_extensions import deprecated
@@ -258,12 +258,7 @@ class FileBasedStreamPartition(Partition):
258
258
  and record_data.record is not None
259
259
  ):
260
260
  # `AirbyteMessage`s of type `Record` should also be yielded so they are enqueued
261
- # If stream is flagged for file_transfer the record should data in file key
262
- record_message_data = (
263
- record_data.record.file
264
- if self._use_file_transfer()
265
- else record_data.record.data
266
- )
261
+ record_message_data = record_data.record.data
267
262
  if not record_message_data:
268
263
  raise ExceptionWithDisplayMessage("A record without data was found")
269
264
  else:
@@ -305,10 +300,6 @@ class FileBasedStreamPartition(Partition):
305
300
  def stream_name(self) -> str:
306
301
  return self._stream.name
307
302
 
308
- @cache
309
- def _use_file_transfer(self) -> bool:
310
- return hasattr(self._stream, "use_file_transfer") and self._stream.use_file_transfer
311
-
312
303
  def __repr__(self) -> str:
313
304
  return f"FileBasedStreamPartition({self._stream.name}, {self._slice})"
314
305
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.45.0.dev4100
3
+ Version: 6.45.0.dev4102
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -216,7 +216,7 @@ airbyte_cdk/sources/file_based/discovery_policy/default_discovery_policy.py,sha2
216
216
  airbyte_cdk/sources/file_based/exceptions.py,sha256=WP0qkG6fpWoBpOyyicgp5YNE393VWyegq5qSy0v4QtM,7362
217
217
  airbyte_cdk/sources/file_based/file_based_source.py,sha256=bIsut7ivHcl7YPO9cygDn0to23MRLu1Sym7jSr0Iy9A,20051
218
218
  airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py,sha256=4e7FXqQ9hueacexC0SyrZyjF8oREYHza8pKF9CgKbD8,5050
219
- airbyte_cdk/sources/file_based/file_based_stream_reader.py,sha256=K19ejtmWLWt-q6ANXGy_VW6eMzVvkbkIaBVoOK3ahA8,6906
219
+ airbyte_cdk/sources/file_based/file_based_stream_reader.py,sha256=r6pjkBfCigTKFd_Z5fGpGR1Ovwxf9rzoFRlec79PGIw,7565
220
220
  airbyte_cdk/sources/file_based/file_record_data.py,sha256=HXduy_owayUhgmbuswOl5UnszWPUAkRiNhDJgZVCVZI,471
221
221
  airbyte_cdk/sources/file_based/file_types/__init__.py,sha256=blCLn0-2LC-ZdgcNyDEhqM2RiUvEjEBh-G4-t32ZtuM,1268
222
222
  airbyte_cdk/sources/file_based/file_types/avro_parser.py,sha256=XNx-JC-sgzH9u3nOJ2M59FxBXvtig8LN6BIkeDOavZA,10858
@@ -235,7 +235,7 @@ airbyte_cdk/sources/file_based/schema_validation_policies/default_schema_validat
235
235
  airbyte_cdk/sources/file_based/stream/__init__.py,sha256=q_zmeOHHg0JK5j1YNSOIsyXGz-wlTl_0E8z5GKVAcVM,543
236
236
  airbyte_cdk/sources/file_based/stream/abstract_file_based_stream.py,sha256=9pQh3BHYcxm8CRC8XawfmBxL8O9HggpWwCCbX_ncINE,7509
237
237
  airbyte_cdk/sources/file_based/stream/concurrent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
238
- airbyte_cdk/sources/file_based/stream/concurrent/adapters.py,sha256=2a9-wSbES-Ehh17WR0WHRuEhUAdhRm7gSl0Ztixzrwo,13851
238
+ airbyte_cdk/sources/file_based/stream/concurrent/adapters.py,sha256=whExivz7qYc561SRy-MJHk7pKt9wK-21Q0GRKd8u1FY,13447
239
239
  airbyte_cdk/sources/file_based/stream/concurrent/cursor/__init__.py,sha256=Rx7TwjH8B7e0eee83Tlqxv1bWn-BVXOmlUAH7auM1uM,344
240
240
  airbyte_cdk/sources/file_based/stream/concurrent/cursor/abstract_concurrent_file_based_cursor.py,sha256=5dYZMLBEbvCyrCT89lCYdm2FdrLPLuxjdpQSVGP5o0w,1856
241
241
  airbyte_cdk/sources/file_based/stream/concurrent/cursor/file_based_concurrent_cursor.py,sha256=gRTL-9I3ejjQOpLKd6ixe9rB3kGlubCdhUt9ri6AdAI,14880
@@ -360,9 +360,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
360
360
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
361
361
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
362
362
  airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
363
- airbyte_cdk-6.45.0.dev4100.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
364
- airbyte_cdk-6.45.0.dev4100.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
365
- airbyte_cdk-6.45.0.dev4100.dist-info/METADATA,sha256=76QoD2QmXEsG_pl2jSBzdCfwXFPPfSHMVZjXs98qkSg,6089
366
- airbyte_cdk-6.45.0.dev4100.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
367
- airbyte_cdk-6.45.0.dev4100.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
368
- airbyte_cdk-6.45.0.dev4100.dist-info/RECORD,,
363
+ airbyte_cdk-6.45.0.dev4102.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
364
+ airbyte_cdk-6.45.0.dev4102.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
365
+ airbyte_cdk-6.45.0.dev4102.dist-info/METADATA,sha256=jAf-_v4EfZ32YxJ8JhbFIwyOf2wPoEO00-srzm-X4nA,6089
366
+ airbyte_cdk-6.45.0.dev4102.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
367
+ airbyte_cdk-6.45.0.dev4102.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
368
+ airbyte_cdk-6.45.0.dev4102.dist-info/RECORD,,