airbyte-cdk 6.45.0.dev4103__py3-none-any.whl → 6.45.0.dev4105__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 Any, Iterable, List, Optional, Set, Tuple, MutableMapping
11
+ from typing import Any, Callable, Iterable, List, Optional, Set, Tuple, MutableMapping
12
12
 
13
13
  from wcmatch.glob import GLOBSTAR, globmatch
14
14
 
@@ -33,7 +33,6 @@ class AbstractFileBasedStreamReader(ABC):
33
33
  FILE_RELATIVE_PATH = "file_relative_path"
34
34
  FILE_NAME = "file_name"
35
35
  LOCAL_FILE_PATH = "local_file_path"
36
- ABSOLUTE_FILE_PATH = "absolute_file_path"
37
36
  SOURCE_FILE_URI = "source_file_relative_path"
38
37
  FILE_FOLDER = "file_folder"
39
38
 
@@ -177,28 +176,30 @@ class AbstractFileBasedStreamReader(ABC):
177
176
  """
178
177
  ...
179
178
 
180
- def _get_file_transfer_paths(self, file: RemoteFile, local_directory: str) -> MutableMapping[str, Any]:
179
+ def _get_file_transfer_paths(self, file: RemoteFile, local_directory: str, parse_file_path_from_uri: Optional[Callable] = None) -> MutableMapping[str, Any]:
181
180
  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)
181
+ if not parse_file_path_from_uri:
182
+ file_path = file.uri
183
+ else:
184
+ file_path = parse_file_path_from_uri(file.uri)
185
+
186
+ file_name = path.basename(file_path)
187
+ file_folder = path.dirname(file_path)
185
188
  if preserve_directory_structure:
186
189
  # Remove left slashes from source path format to make relative path for writing locally
187
- file_relative_path = file_uri.lstrip("/")
190
+ file_relative_path = file_path.lstrip("/")
188
191
  else:
189
192
  file_relative_path = file_name
190
193
  local_file_path = path.join(local_directory, file_relative_path)
191
194
  # Ensure the local directory exists
192
195
  makedirs(path.dirname(local_file_path), exist_ok=True)
193
- absolute_file_path = path.abspath(local_file_path)
194
196
 
195
197
  file_paths = {
196
198
  self.FILE_RELATIVE_PATH: file_relative_path,
197
199
  self.LOCAL_FILE_PATH: local_file_path,
198
- self.ABSOLUTE_FILE_PATH: absolute_file_path,
199
200
  self.FILE_NAME: file_name,
200
201
  self.FILE_FOLDER: file_folder,
201
- self.SOURCE_FILE_URI: file_uri,
202
+ self.SOURCE_FILE_URI: file.uri,
202
203
 
203
204
  }
204
205
  return file_paths
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.45.0.dev4103
3
+ Version: 6.45.0.dev4105
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=r6pjkBfCigTKFd_Z5fGpGR1Ovwxf9rzoFRlec79PGIw,7565
219
+ airbyte_cdk/sources/file_based/file_based_stream_reader.py,sha256=9ZLw_bOGsEknHEq7oj4u-hHiSIhI06SjKLppnS56bRg,7589
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
@@ -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.dev4103.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
364
- airbyte_cdk-6.45.0.dev4103.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
365
- airbyte_cdk-6.45.0.dev4103.dist-info/METADATA,sha256=ufps3IwtnCViELy0tRLjWqrsn7MfI2z2ZFplamOCl9I,6089
366
- airbyte_cdk-6.45.0.dev4103.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
367
- airbyte_cdk-6.45.0.dev4103.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
368
- airbyte_cdk-6.45.0.dev4103.dist-info/RECORD,,
363
+ airbyte_cdk-6.45.0.dev4105.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
364
+ airbyte_cdk-6.45.0.dev4105.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
365
+ airbyte_cdk-6.45.0.dev4105.dist-info/METADATA,sha256=2LM5Z602-cE9z83VCkoEmwk-zI_Ey2AltrkBw24ibHQ,6089
366
+ airbyte_cdk-6.45.0.dev4105.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
367
+ airbyte_cdk-6.45.0.dev4105.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
368
+ airbyte_cdk-6.45.0.dev4105.dist-info/RECORD,,