airbyte-cdk 0.71.0__py3-none-any.whl → 0.72.0__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/declarative/declarative_component_schema.yaml +22 -0
- airbyte_cdk/sources/declarative/models/declarative_component_schema.py +17 -1
- airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py +2 -0
- {airbyte_cdk-0.71.0.dist-info → airbyte_cdk-0.72.0.dist-info}/METADATA +1 -1
- {airbyte_cdk-0.71.0.dist-info → airbyte_cdk-0.72.0.dist-info}/RECORD +9 -9
- unit_tests/sources/declarative/parsers/test_model_to_component_factory.py +19 -0
- {airbyte_cdk-0.71.0.dist-info → airbyte_cdk-0.72.0.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-0.71.0.dist-info → airbyte_cdk-0.72.0.dist-info}/WHEEL +0 -0
- {airbyte_cdk-0.71.0.dist-info → airbyte_cdk-0.72.0.dist-info}/top_level.txt +0 -0
@@ -602,6 +602,27 @@ definitions:
|
|
602
602
|
$parameters:
|
603
603
|
type: object
|
604
604
|
additionalProperties: true
|
605
|
+
CustomSchemaLoader:
|
606
|
+
title: Custom Schema Loader
|
607
|
+
description: Schema Loader component whose behavior is derived from a custom code implementation of the connector.
|
608
|
+
type: object
|
609
|
+
additionalProperties: true
|
610
|
+
required:
|
611
|
+
- type
|
612
|
+
- class_name
|
613
|
+
properties:
|
614
|
+
type:
|
615
|
+
type: string
|
616
|
+
enum: [CustomSchemaLoader]
|
617
|
+
class_name:
|
618
|
+
title: Class Name
|
619
|
+
description: Fully-qualified name of the class that will be implementing the custom schema loader. The format is `source_<name>.<package>.<class_name>`.
|
620
|
+
type: string
|
621
|
+
examples:
|
622
|
+
- "source_railz.components.MyCustomSchemaLoader"
|
623
|
+
$parameters:
|
624
|
+
type: object
|
625
|
+
additionalProperties: true
|
605
626
|
CustomTransformation:
|
606
627
|
title: Custom Transformation
|
607
628
|
description: Transformation component whose behavior is derived from a custom code implementation of the connector.
|
@@ -948,6 +969,7 @@ definitions:
|
|
948
969
|
anyOf:
|
949
970
|
- "$ref": "#/definitions/InlineSchemaLoader"
|
950
971
|
- "$ref": "#/definitions/JsonFileSchemaLoader"
|
972
|
+
- "$ref": "#/definitions/CustomSchemaLoader"
|
951
973
|
# TODO we have move the transformation to the RecordSelector level in the code but kept this here for
|
952
974
|
# compatibility reason. We should eventually move this to align with the code.
|
953
975
|
transformations:
|
@@ -208,6 +208,20 @@ class CustomPartitionRouter(BaseModel):
|
|
208
208
|
parameters: Optional[Dict[str, Any]] = Field(None, alias='$parameters')
|
209
209
|
|
210
210
|
|
211
|
+
class CustomSchemaLoader(BaseModel):
|
212
|
+
class Config:
|
213
|
+
extra = Extra.allow
|
214
|
+
|
215
|
+
type: Literal['CustomSchemaLoader']
|
216
|
+
class_name: str = Field(
|
217
|
+
...,
|
218
|
+
description='Fully-qualified name of the class that will be implementing the custom schema loader. The format is `source_<name>.<package>.<class_name>`.',
|
219
|
+
examples=['source_railz.components.MyCustomSchemaLoader'],
|
220
|
+
title='Class Name',
|
221
|
+
)
|
222
|
+
parameters: Optional[Dict[str, Any]] = Field(None, alias='$parameters')
|
223
|
+
|
224
|
+
|
211
225
|
class CustomTransformation(BaseModel):
|
212
226
|
class Config:
|
213
227
|
extra = Extra.allow
|
@@ -1161,7 +1175,9 @@ class DeclarativeStream(BaseModel):
|
|
1161
1175
|
primary_key: Optional[PrimaryKey] = Field(
|
1162
1176
|
'', description='The primary key of the stream.', title='Primary Key'
|
1163
1177
|
)
|
1164
|
-
schema_loader: Optional[
|
1178
|
+
schema_loader: Optional[
|
1179
|
+
Union[InlineSchemaLoader, JsonFileSchemaLoader, CustomSchemaLoader]
|
1180
|
+
] = Field(
|
1165
1181
|
None,
|
1166
1182
|
description='Component used to retrieve the schema for the current stream.',
|
1167
1183
|
title='Schema Loader',
|
@@ -49,6 +49,7 @@ from airbyte_cdk.sources.declarative.models.declarative_component_schema import
|
|
49
49
|
from airbyte_cdk.sources.declarative.models.declarative_component_schema import CustomRecordFilter as CustomRecordFilterModel
|
50
50
|
from airbyte_cdk.sources.declarative.models.declarative_component_schema import CustomRequester as CustomRequesterModel
|
51
51
|
from airbyte_cdk.sources.declarative.models.declarative_component_schema import CustomRetriever as CustomRetrieverModel
|
52
|
+
from airbyte_cdk.sources.declarative.models.declarative_component_schema import CustomSchemaLoader as CustomSchemaLoader
|
52
53
|
from airbyte_cdk.sources.declarative.models.declarative_component_schema import CustomTransformation as CustomTransformationModel
|
53
54
|
from airbyte_cdk.sources.declarative.models.declarative_component_schema import DatetimeBasedCursor as DatetimeBasedCursorModel
|
54
55
|
from airbyte_cdk.sources.declarative.models.declarative_component_schema import DeclarativeStream as DeclarativeStreamModel
|
@@ -165,6 +166,7 @@ class ModelToComponentFactory:
|
|
165
166
|
CustomRecordFilterModel: self.create_custom_component,
|
166
167
|
CustomRequesterModel: self.create_custom_component,
|
167
168
|
CustomRetrieverModel: self.create_custom_component,
|
169
|
+
CustomSchemaLoader: self.create_custom_component,
|
168
170
|
CustomPaginationStrategyModel: self.create_custom_component,
|
169
171
|
CustomPartitionRouterModel: self.create_custom_component,
|
170
172
|
CustomTransformationModel: self.create_custom_component,
|
@@ -38,7 +38,7 @@ airbyte_cdk/sources/concurrent_source/partition_generation_completed_sentinel.py
|
|
38
38
|
airbyte_cdk/sources/concurrent_source/thread_pool_manager.py,sha256=hFj5rsRtORurl3fwH8GC9h6Uz2wbzBFOLWUxJ-YJ7J8,4801
|
39
39
|
airbyte_cdk/sources/declarative/__init__.py,sha256=ZnqYNxHsKCgO38IwB34RQyRMXTs4GTvlRi3ImKnIioo,61
|
40
40
|
airbyte_cdk/sources/declarative/create_partial.py,sha256=sUJOwD8hBzW4pxw2XhYlSTMgl-WMc5WpP5Oq_jo3fHw,3371
|
41
|
-
airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=
|
41
|
+
airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=netrMub3A9k9wk5VWx8vqDWhfeLk_sviHHJ8NXnH2OA,90111
|
42
42
|
airbyte_cdk/sources/declarative/declarative_source.py,sha256=U2As9PDKmcWDgbsWUo-RetJ9fxQOBlwntWZ0NOgs5Ac,1453
|
43
43
|
airbyte_cdk/sources/declarative/declarative_stream.py,sha256=9nBjSBilzH2aeJsUEqOLyc4G2RRjlPZCapHDMv4jnOU,6691
|
44
44
|
airbyte_cdk/sources/declarative/exceptions.py,sha256=kTPUA4I2NV4J6HDz-mKPGMrfuc592akJnOyYx38l_QM,176
|
@@ -80,14 +80,14 @@ airbyte_cdk/sources/declarative/interpolation/interpolation.py,sha256=dyIM-bzh54
|
|
80
80
|
airbyte_cdk/sources/declarative/interpolation/jinja.py,sha256=hOLBs9VaaE5xsT2wY2VxSrISE165bu_Egb83ordG4XI,5379
|
81
81
|
airbyte_cdk/sources/declarative/interpolation/macros.py,sha256=V6WGKJ9cXX1rjuM4bK3Cs9xEryMlkY2U3FMsSBhrgC8,3098
|
82
82
|
airbyte_cdk/sources/declarative/models/__init__.py,sha256=EiYnzwCHZV7EYqMJqcy6xKSeHvTKZBsQndjbEwmiTW4,93
|
83
|
-
airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=
|
83
|
+
airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=1a67m2fGAdBRf7rOzvk5SIluQHIWL4SPLnrjsnrnm_s,61574
|
84
84
|
airbyte_cdk/sources/declarative/parsers/__init__.py,sha256=ZnqYNxHsKCgO38IwB34RQyRMXTs4GTvlRi3ImKnIioo,61
|
85
85
|
airbyte_cdk/sources/declarative/parsers/class_types_registry.py,sha256=5vOvMuyWlpALrOq2ehLxa7wO6tlFIlgUNtMYrMCKIjE,6092
|
86
86
|
airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=y7_G5mM07zxT5YG975kdC2PAja-Uc83pYp8WrV3GNdo,522
|
87
87
|
airbyte_cdk/sources/declarative/parsers/default_implementation_registry.py,sha256=W8BcK4KOg4ifNXgsdeIoV4oneHjXBKcPHEZHIC4r-hM,3801
|
88
88
|
airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py,sha256=i2yUdrdlPUHI0dSQX0zBT8WSg912SMiCF8qkQ8VvlA4,8287
|
89
89
|
airbyte_cdk/sources/declarative/parsers/manifest_reference_resolver.py,sha256=6ukHx0bBrCJm9rek1l_MEfS3U_gdJcM4pJRyifJEOp0,6412
|
90
|
-
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=
|
90
|
+
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=1zI1Mk9k_3p_TMz6LsgV7U54CJ6etl88q8WOv4AZO-w,59499
|
91
91
|
airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=27sOWhw2LBQs62HchURakHQ2M_mtnOatNgU6q8RUtpU,476
|
92
92
|
airbyte_cdk/sources/declarative/partition_routers/list_partition_router.py,sha256=L22D-up7W2HahZZo2dA-IbRSs7qJEahU6O6bU0eiIt8,4324
|
93
93
|
airbyte_cdk/sources/declarative/partition_routers/single_partition_router.py,sha256=cl-TQdu_m6_IF20gdD1jll0SpejIyMZHvyGXx2NafuI,1611
|
@@ -329,7 +329,7 @@ unit_tests/sources/declarative/interpolation/test_macros.py,sha256=vEZmHQ0KsfQUz
|
|
329
329
|
unit_tests/sources/declarative/parsers/__init__.py,sha256=ZnqYNxHsKCgO38IwB34RQyRMXTs4GTvlRi3ImKnIioo,61
|
330
330
|
unit_tests/sources/declarative/parsers/test_manifest_component_transformer.py,sha256=egePHWYcXprfPtoHhiquWAXuJkDr-DB_RakKhdyaoHs,14316
|
331
331
|
unit_tests/sources/declarative/parsers/test_manifest_reference_resolver.py,sha256=K3q9eyx-sJFQ8nGYjAgS7fxau4sX_FlNreEAjiCYOeE,5306
|
332
|
-
unit_tests/sources/declarative/parsers/test_model_to_component_factory.py,sha256=
|
332
|
+
unit_tests/sources/declarative/parsers/test_model_to_component_factory.py,sha256=cDlDoNutC6JMGdyvkYMteiHtVrpQ_cKnRE_yn6dWui0,76426
|
333
333
|
unit_tests/sources/declarative/parsers/testing_components.py,sha256=_yUijmYRM-yYHPGDB2JsfEiOuVrgexGW9QwHf1xxNW8,1326
|
334
334
|
unit_tests/sources/declarative/partition_routers/__init__.py,sha256=O8MZg4Bv_DghdRy9BoJCPIqdV75VtiUrhEkExQgb2nE,61
|
335
335
|
unit_tests/sources/declarative/partition_routers/test_list_partition_router.py,sha256=WKdbAQCHfCVOyoAFM_kbHsbqAF_e5FX5Zvou5ARsJZ4,6572
|
@@ -459,8 +459,8 @@ unit_tests/utils/test_schema_inferrer.py,sha256=Z2jHBZ540wnYkylIdV_2xr75Vtwlxuyg
|
|
459
459
|
unit_tests/utils/test_secret_utils.py,sha256=CdKK8A2-5XVxbXVtX22FK9dwwMeP5KNqDH6luWRXSNw,5256
|
460
460
|
unit_tests/utils/test_stream_status_utils.py,sha256=Xr8MZ2HWgTVIyMbywDvuYkRaUF4RZLQOT8-JjvcfR24,2970
|
461
461
|
unit_tests/utils/test_traced_exception.py,sha256=bDFP5zMBizFenz6V2WvEZTRCKGB5ijh3DBezjbfoYIs,4198
|
462
|
-
airbyte_cdk-0.
|
463
|
-
airbyte_cdk-0.
|
464
|
-
airbyte_cdk-0.
|
465
|
-
airbyte_cdk-0.
|
466
|
-
airbyte_cdk-0.
|
462
|
+
airbyte_cdk-0.72.0.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
463
|
+
airbyte_cdk-0.72.0.dist-info/METADATA,sha256=lDN4hbkJHUsXxycTKKTDAgCzzo72JYBIzlCOZzuU0nM,11074
|
464
|
+
airbyte_cdk-0.72.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
465
|
+
airbyte_cdk-0.72.0.dist-info/top_level.txt,sha256=edvsDKTnE6sD2wfCUaeTfKf5gQIL6CPVMwVL2sWZzqo,51
|
466
|
+
airbyte_cdk-0.72.0.dist-info/RECORD,,
|
@@ -5,6 +5,7 @@
|
|
5
5
|
# mypy: ignore-errors
|
6
6
|
|
7
7
|
import datetime
|
8
|
+
from typing import Any, Mapping
|
8
9
|
|
9
10
|
import pytest
|
10
11
|
from airbyte_cdk.models import Level
|
@@ -27,6 +28,7 @@ from airbyte_cdk.sources.declarative.models import CheckStream as CheckStreamMod
|
|
27
28
|
from airbyte_cdk.sources.declarative.models import CompositeErrorHandler as CompositeErrorHandlerModel
|
28
29
|
from airbyte_cdk.sources.declarative.models import CustomErrorHandler as CustomErrorHandlerModel
|
29
30
|
from airbyte_cdk.sources.declarative.models import CustomPartitionRouter as CustomPartitionRouterModel
|
31
|
+
from airbyte_cdk.sources.declarative.models import CustomSchemaLoader as CustomSchemaLoaderModel
|
30
32
|
from airbyte_cdk.sources.declarative.models import DatetimeBasedCursor as DatetimeBasedCursorModel
|
31
33
|
from airbyte_cdk.sources.declarative.models import DeclarativeStream as DeclarativeStreamModel
|
32
34
|
from airbyte_cdk.sources.declarative.models import DefaultPaginator as DefaultPaginatorModel
|
@@ -66,6 +68,7 @@ from airbyte_cdk.sources.declarative.requesters.request_path import RequestPath
|
|
66
68
|
from airbyte_cdk.sources.declarative.requesters.requester import HttpMethod
|
67
69
|
from airbyte_cdk.sources.declarative.retrievers import SimpleRetriever, SimpleRetrieverTestReadDecorator
|
68
70
|
from airbyte_cdk.sources.declarative.schema import JsonFileSchemaLoader
|
71
|
+
from airbyte_cdk.sources.declarative.schema.schema_loader import SchemaLoader
|
69
72
|
from airbyte_cdk.sources.declarative.spec import Spec
|
70
73
|
from airbyte_cdk.sources.declarative.stream_slicers import CartesianProductStreamSlicer
|
71
74
|
from airbyte_cdk.sources.declarative.transformations import AddFields, RemoveFields
|
@@ -1820,3 +1823,19 @@ def test_create_offset_increment():
|
|
1820
1823
|
assert strategy.page_size == expected_strategy.page_size
|
1821
1824
|
assert strategy.inject_on_first_request == expected_strategy.inject_on_first_request
|
1822
1825
|
assert strategy.config == input_config
|
1826
|
+
|
1827
|
+
|
1828
|
+
class MyCustomSchemaLoader(SchemaLoader):
|
1829
|
+
def get_json_schema(self) -> Mapping[str, Any]:
|
1830
|
+
"""Returns a mapping describing the stream's schema"""
|
1831
|
+
return {}
|
1832
|
+
|
1833
|
+
|
1834
|
+
def test_create_custom_schema_loader():
|
1835
|
+
|
1836
|
+
definition = {
|
1837
|
+
"type": "CustomSchemaLoader",
|
1838
|
+
"class_name": "unit_tests.sources.declarative.parsers.test_model_to_component_factory.MyCustomSchemaLoader"
|
1839
|
+
}
|
1840
|
+
component = factory.create_component(CustomSchemaLoaderModel, definition, {})
|
1841
|
+
assert isinstance(component, MyCustomSchemaLoader)
|
File without changes
|
File without changes
|
File without changes
|