airbyte-cdk 7.3.8__py3-none-any.whl → 7.3.9.post2.dev18667058048__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.
- airbyte_cdk/sources/file_based/exceptions.py +4 -0
- airbyte_cdk/sources/file_based/file_types/csv_parser.py +6 -2
- airbyte_cdk/sources/file_based/stream/default_file_based_stream.py +32 -12
- {airbyte_cdk-7.3.8.dist-info → airbyte_cdk-7.3.9.post2.dev18667058048.dist-info}/METADATA +1 -1
- {airbyte_cdk-7.3.8.dist-info → airbyte_cdk-7.3.9.post2.dev18667058048.dist-info}/RECORD +9 -9
- {airbyte_cdk-7.3.8.dist-info → airbyte_cdk-7.3.9.post2.dev18667058048.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-7.3.8.dist-info → airbyte_cdk-7.3.9.post2.dev18667058048.dist-info}/LICENSE_SHORT +0 -0
- {airbyte_cdk-7.3.8.dist-info → airbyte_cdk-7.3.9.post2.dev18667058048.dist-info}/WHEEL +0 -0
- {airbyte_cdk-7.3.8.dist-info → airbyte_cdk-7.3.9.post2.dev18667058048.dist-info}/entry_points.txt +0 -0
|
@@ -22,7 +22,11 @@ from airbyte_cdk.sources.file_based.config.csv_format import (
|
|
|
22
22
|
InferenceType,
|
|
23
23
|
)
|
|
24
24
|
from airbyte_cdk.sources.file_based.config.file_based_stream_config import FileBasedStreamConfig
|
|
25
|
-
from airbyte_cdk.sources.file_based.exceptions import
|
|
25
|
+
from airbyte_cdk.sources.file_based.exceptions import (
|
|
26
|
+
EmptyFileSchemaInferenceError,
|
|
27
|
+
FileBasedSourceError,
|
|
28
|
+
RecordParseError,
|
|
29
|
+
)
|
|
26
30
|
from airbyte_cdk.sources.file_based.file_based_stream_reader import (
|
|
27
31
|
AbstractFileBasedStreamReader,
|
|
28
32
|
FileReadMode,
|
|
@@ -203,7 +207,7 @@ class CsvParser(FileTypeParser):
|
|
|
203
207
|
break
|
|
204
208
|
|
|
205
209
|
if not type_inferrer_by_field:
|
|
206
|
-
raise
|
|
210
|
+
raise EmptyFileSchemaInferenceError(
|
|
207
211
|
message=f"Could not infer schema as there are no rows in {file.uri}. If having an empty CSV file is expected, ignore this. "
|
|
208
212
|
f"Else, please contact Airbyte.",
|
|
209
213
|
failure_type=FailureType.config_error,
|
|
@@ -9,13 +9,26 @@ from collections import defaultdict
|
|
|
9
9
|
from copy import deepcopy
|
|
10
10
|
from functools import cache
|
|
11
11
|
from os import path
|
|
12
|
-
from typing import
|
|
12
|
+
from typing import (
|
|
13
|
+
Any,
|
|
14
|
+
Dict,
|
|
15
|
+
Iterable,
|
|
16
|
+
List,
|
|
17
|
+
Mapping,
|
|
18
|
+
MutableMapping,
|
|
19
|
+
NoReturn,
|
|
20
|
+
Optional,
|
|
21
|
+
Set,
|
|
22
|
+
Tuple,
|
|
23
|
+
Union,
|
|
24
|
+
)
|
|
13
25
|
|
|
14
26
|
from airbyte_cdk.models import AirbyteLogMessage, AirbyteMessage, AirbyteStream, FailureType, Level
|
|
15
27
|
from airbyte_cdk.models import Type as MessageType
|
|
16
28
|
from airbyte_cdk.sources.file_based.config.file_based_stream_config import PrimaryKeyType
|
|
17
29
|
from airbyte_cdk.sources.file_based.exceptions import (
|
|
18
30
|
DuplicatedFilesError,
|
|
31
|
+
EmptyFileSchemaInferenceError,
|
|
19
32
|
FileBasedSourceError,
|
|
20
33
|
InvalidSchemaError,
|
|
21
34
|
MissingSchemaError,
|
|
@@ -230,7 +243,7 @@ class DefaultFileBasedStream(AbstractFileBasedStream, IncrementalMixin):
|
|
|
230
243
|
return self.ab_last_mod_col
|
|
231
244
|
|
|
232
245
|
@cache
|
|
233
|
-
def get_json_schema(self) -> JsonSchema:
|
|
246
|
+
def get_json_schema(self) -> JsonSchema: # type: ignore
|
|
234
247
|
if self.use_file_transfer:
|
|
235
248
|
return file_transfer_schema
|
|
236
249
|
extra_fields = {
|
|
@@ -246,12 +259,12 @@ class DefaultFileBasedStream(AbstractFileBasedStream, IncrementalMixin):
|
|
|
246
259
|
exception=AirbyteTracedException(exception=config_exception),
|
|
247
260
|
failure_type=FailureType.config_error,
|
|
248
261
|
)
|
|
262
|
+
except EmptyFileSchemaInferenceError as exc:
|
|
263
|
+
self._raise_schema_inference_error(exc)
|
|
249
264
|
except AirbyteTracedException as ate:
|
|
250
265
|
raise ate
|
|
251
266
|
except Exception as exc:
|
|
252
|
-
|
|
253
|
-
FileBasedSourceError.SCHEMA_INFERENCE_ERROR, stream=self.name
|
|
254
|
-
) from exc
|
|
267
|
+
self._raise_schema_inference_error(exc)
|
|
255
268
|
else:
|
|
256
269
|
return {"type": "object", "properties": {**extra_fields, **schema["properties"]}}
|
|
257
270
|
|
|
@@ -380,17 +393,24 @@ class DefaultFileBasedStream(AbstractFileBasedStream, IncrementalMixin):
|
|
|
380
393
|
|
|
381
394
|
return base_schema
|
|
382
395
|
|
|
383
|
-
async def _infer_file_schema(self, file: RemoteFile) -> SchemaType:
|
|
396
|
+
async def _infer_file_schema(self, file: RemoteFile) -> SchemaType: # type: ignore
|
|
384
397
|
try:
|
|
385
398
|
return await self.get_parser().infer_schema(
|
|
386
399
|
self.config, file, self.stream_reader, self.logger
|
|
387
400
|
)
|
|
401
|
+
except EmptyFileSchemaInferenceError as exc:
|
|
402
|
+
self._raise_schema_inference_error(exc, file)
|
|
388
403
|
except AirbyteTracedException as ate:
|
|
389
404
|
raise ate
|
|
390
405
|
except Exception as exc:
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
406
|
+
self._raise_schema_inference_error(exc, file)
|
|
407
|
+
|
|
408
|
+
def _raise_schema_inference_error(
|
|
409
|
+
self, exc: Exception, file: Optional[RemoteFile] = None
|
|
410
|
+
) -> NoReturn:
|
|
411
|
+
raise SchemaInferenceError(
|
|
412
|
+
FileBasedSourceError.SCHEMA_INFERENCE_ERROR,
|
|
413
|
+
file=file.uri if file else None,
|
|
414
|
+
format=str(self.config.format) if self.config.format else None,
|
|
415
|
+
stream=self.name,
|
|
416
|
+
) from exc
|
|
@@ -296,14 +296,14 @@ airbyte_cdk/sources/file_based/config/validate_config_transfer_modes.py,sha256=O
|
|
|
296
296
|
airbyte_cdk/sources/file_based/discovery_policy/__init__.py,sha256=gl3ey6mZbyfraB9P3pFhf9UJp2JeTZ1SUFAopy2iBvY,301
|
|
297
297
|
airbyte_cdk/sources/file_based/discovery_policy/abstract_discovery_policy.py,sha256=dCfXX529Rd5rtopg4VeEgTPJjFtqjtjzPq6LCw18Wt0,605
|
|
298
298
|
airbyte_cdk/sources/file_based/discovery_policy/default_discovery_policy.py,sha256=-xujTidtrq6HC00WKbjQh1CZdT5LMuzkp5BLjqDmfTY,1007
|
|
299
|
-
airbyte_cdk/sources/file_based/exceptions.py,sha256=
|
|
299
|
+
airbyte_cdk/sources/file_based/exceptions.py,sha256=pD_5avYUTVgDTDKedSHkivlohxlM4bfIAVmsl16LCAo,7434
|
|
300
300
|
airbyte_cdk/sources/file_based/file_based_source.py,sha256=Xg8OYWnGc-OcVBglvS08uwAWGWHBhEqsBnyODIkOK-4,20051
|
|
301
301
|
airbyte_cdk/sources/file_based/file_based_stream_permissions_reader.py,sha256=4e7FXqQ9hueacexC0SyrZyjF8oREYHza8pKF9CgKbD8,5050
|
|
302
302
|
airbyte_cdk/sources/file_based/file_based_stream_reader.py,sha256=Yg9KRXpyAtElBrUOO8oX4WHQH6k6Lk7keklrZmB5Klg,9614
|
|
303
303
|
airbyte_cdk/sources/file_based/file_record_data.py,sha256=Vkr5AyZzlsOezjVCLhFrm_WpymlQdolWCnFAwqLJ9Iw,453
|
|
304
304
|
airbyte_cdk/sources/file_based/file_types/__init__.py,sha256=blCLn0-2LC-ZdgcNyDEhqM2RiUvEjEBh-G4-t32ZtuM,1268
|
|
305
305
|
airbyte_cdk/sources/file_based/file_types/avro_parser.py,sha256=USEYqiICXBWpDV443VtNOCmUA-GINzY_Zah74_5w3qQ,10860
|
|
306
|
-
airbyte_cdk/sources/file_based/file_types/csv_parser.py,sha256=
|
|
306
|
+
airbyte_cdk/sources/file_based/file_types/csv_parser.py,sha256=7DmwH1sHx08j7s58zfRydpU9OGl8V2wOEK_IUKC0Wy8,20500
|
|
307
307
|
airbyte_cdk/sources/file_based/file_types/excel_parser.py,sha256=eN47x7TnRSMXXy2NOBHffOnNZLwkyQuHNUR0K_sXw0Y,7134
|
|
308
308
|
airbyte_cdk/sources/file_based/file_types/file_transfer.py,sha256=rFxWaqItBux9tPf4xU03LT6b-wDZf1QolM92mP8Diuk,1120
|
|
309
309
|
airbyte_cdk/sources/file_based/file_types/file_type_parser.py,sha256=JgpH21PrbRqwK92BJklZWvh2TndA6xZ-eP1LPMo44oQ,2832
|
|
@@ -326,7 +326,7 @@ airbyte_cdk/sources/file_based/stream/concurrent/cursor/file_based_final_state_c
|
|
|
326
326
|
airbyte_cdk/sources/file_based/stream/cursor/__init__.py,sha256=MhFB5hOo8sjwvCh8gangaymdg3EJWYt_72brFOZt068,191
|
|
327
327
|
airbyte_cdk/sources/file_based/stream/cursor/abstract_file_based_cursor.py,sha256=om-x3gZFPgWDpi15S9RxZmR36VHnk8sytgN6LlBQhAw,1934
|
|
328
328
|
airbyte_cdk/sources/file_based/stream/cursor/default_file_based_cursor.py,sha256=VGV7xLyBribuBMVrXtO1xqkWJD86bl7yhXtjnwLMohM,7051
|
|
329
|
-
airbyte_cdk/sources/file_based/stream/default_file_based_stream.py,sha256=
|
|
329
|
+
airbyte_cdk/sources/file_based/stream/default_file_based_stream.py,sha256=LaVegOgqMnsCihtWJxRpo6wB0w3bwS27UONnOhtm2QA,17614
|
|
330
330
|
airbyte_cdk/sources/file_based/stream/identities_stream.py,sha256=FZH83Geoy3K3nwUk2VVNJERFcXUTnl-4XljjucUM23s,1893
|
|
331
331
|
airbyte_cdk/sources/file_based/stream/permissions_file_based_stream.py,sha256=6KxqdD3-VvwxDTk7TtZ0M32fga4CI3qZ9IKdAkySpx0,3844
|
|
332
332
|
airbyte_cdk/sources/file_based/types.py,sha256=INxG7OPnkdUP69oYNKMAbwhvV1AGvLRHs1J6pIia2FI,218
|
|
@@ -459,9 +459,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
|
|
|
459
459
|
airbyte_cdk/utils/spec_schema_transformations.py,sha256=9YDJmnIGFsT51CVQf2tSSvTapGimITjEFGbUTSZAGTI,963
|
|
460
460
|
airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
|
|
461
461
|
airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
|
|
462
|
-
airbyte_cdk-7.3.
|
|
463
|
-
airbyte_cdk-7.3.
|
|
464
|
-
airbyte_cdk-7.3.
|
|
465
|
-
airbyte_cdk-7.3.
|
|
466
|
-
airbyte_cdk-7.3.
|
|
467
|
-
airbyte_cdk-7.3.
|
|
462
|
+
airbyte_cdk-7.3.9.post2.dev18667058048.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
|
463
|
+
airbyte_cdk-7.3.9.post2.dev18667058048.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
|
|
464
|
+
airbyte_cdk-7.3.9.post2.dev18667058048.dist-info/METADATA,sha256=qXNgvIOFA63FeGgWN7HJ-e0SfQA9if25LIFffhynZOM,6780
|
|
465
|
+
airbyte_cdk-7.3.9.post2.dev18667058048.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
466
|
+
airbyte_cdk-7.3.9.post2.dev18667058048.dist-info/entry_points.txt,sha256=eLZ2UYvJZGm1s07Pplcs--1Gim60YhZWTb53j_dghwU,195
|
|
467
|
+
airbyte_cdk-7.3.9.post2.dev18667058048.dist-info/RECORD,,
|
{airbyte_cdk-7.3.8.dist-info → airbyte_cdk-7.3.9.post2.dev18667058048.dist-info}/LICENSE.txt
RENAMED
|
File without changes
|
{airbyte_cdk-7.3.8.dist-info → airbyte_cdk-7.3.9.post2.dev18667058048.dist-info}/LICENSE_SHORT
RENAMED
|
File without changes
|
|
File without changes
|
{airbyte_cdk-7.3.8.dist-info → airbyte_cdk-7.3.9.post2.dev18667058048.dist-info}/entry_points.txt
RENAMED
|
File without changes
|