airbyte-cdk 6.8.3rc1__py3-none-any.whl → 6.9.0.dev0__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/concurrent_declarative_source.py +7 -3
- airbyte_cdk/sources/declarative/declarative_component_schema.yaml +186 -2
- airbyte_cdk/sources/declarative/manifest_declarative_source.py +53 -2
- airbyte_cdk/sources/declarative/models/declarative_component_schema.py +137 -6
- airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py +10 -0
- airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py +167 -21
- airbyte_cdk/sources/declarative/partition_routers/__init__.py +2 -1
- airbyte_cdk/sources/declarative/resolvers/__init__.py +13 -0
- airbyte_cdk/sources/declarative/resolvers/components_resolver.py +55 -0
- airbyte_cdk/sources/declarative/resolvers/http_components_resolver.py +106 -0
- airbyte_cdk/sources/declarative/schema/__init__.py +2 -1
- airbyte_cdk/sources/declarative/schema/dynamic_schema_loader.py +219 -0
- airbyte_cdk-6.9.0.dev0.dist-info/METADATA +111 -0
- {airbyte_cdk-6.8.3rc1.dist-info → airbyte_cdk-6.9.0.dev0.dist-info}/RECORD +17 -14
- airbyte_cdk/test/utils/manifest_only_fixtures.py +0 -55
- airbyte_cdk-6.8.3rc1.dist-info/METADATA +0 -306
- {airbyte_cdk-6.8.3rc1.dist-info → airbyte_cdk-6.9.0.dev0.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-6.8.3rc1.dist-info → airbyte_cdk-6.9.0.dev0.dist-info}/WHEEL +0 -0
- {airbyte_cdk-6.8.3rc1.dist-info → airbyte_cdk-6.9.0.dev0.dist-info}/entry_points.txt +0 -0
@@ -192,9 +192,13 @@ class ConcurrentDeclarativeSource(ManifestDeclarativeSource, Generic[TState]):
|
|
192
192
|
|
193
193
|
state_manager = ConnectorStateManager(state=self._state) # type: ignore # state is always in the form of List[AirbyteStateMessage]. The ConnectorStateManager should use generics, but this can be done later
|
194
194
|
|
195
|
-
|
196
|
-
|
197
|
-
|
195
|
+
# Combine streams and dynamic_streams. Note: both cannot be empty at the same time,
|
196
|
+
# and this is validated during the initialization of the source.
|
197
|
+
streams = self._stream_configs(self._source_config) + self._dynamic_stream_configs(
|
198
|
+
self._source_config, config
|
199
|
+
)
|
200
|
+
|
201
|
+
name_to_stream_mapping = {stream["name"]: stream for stream in streams}
|
198
202
|
|
199
203
|
for declarative_stream in self.streams(config=config):
|
200
204
|
# Some low-code sources use a combination of DeclarativeStream and regular Python streams. We can't inspect
|
@@ -7,8 +7,12 @@ version: 1.0.0
|
|
7
7
|
required:
|
8
8
|
- type
|
9
9
|
- check
|
10
|
-
- streams
|
11
10
|
- version
|
11
|
+
anyOf:
|
12
|
+
- required:
|
13
|
+
- streams
|
14
|
+
- required:
|
15
|
+
- dynamic_streams
|
12
16
|
properties:
|
13
17
|
type:
|
14
18
|
type: string
|
@@ -19,6 +23,10 @@ properties:
|
|
19
23
|
type: array
|
20
24
|
items:
|
21
25
|
"$ref": "#/definitions/DeclarativeStream"
|
26
|
+
dynamic_streams:
|
27
|
+
type: array
|
28
|
+
items:
|
29
|
+
"$ref": "#/definitions/DynamicDeclarativeStream"
|
22
30
|
version:
|
23
31
|
type: string
|
24
32
|
description: The version of the Airbyte CDK used to build and test the source.
|
@@ -1321,7 +1329,7 @@ definitions:
|
|
1321
1329
|
type: array
|
1322
1330
|
items:
|
1323
1331
|
- type: string
|
1324
|
-
|
1332
|
+
interpolation_context:
|
1325
1333
|
- config
|
1326
1334
|
examples:
|
1327
1335
|
- ["data"]
|
@@ -1676,6 +1684,92 @@ definitions:
|
|
1676
1684
|
$parameters:
|
1677
1685
|
type: object
|
1678
1686
|
additionalProperties: true
|
1687
|
+
TypesMap:
|
1688
|
+
title: Types Map
|
1689
|
+
description: (This component is experimental. Use at your own risk.) Represents a mapping between a current type and its corresponding target type.
|
1690
|
+
type: object
|
1691
|
+
required:
|
1692
|
+
- target_type
|
1693
|
+
- current_type
|
1694
|
+
properties:
|
1695
|
+
target_type:
|
1696
|
+
anyOf:
|
1697
|
+
- type: string
|
1698
|
+
- type: array
|
1699
|
+
items:
|
1700
|
+
type: string
|
1701
|
+
current_type:
|
1702
|
+
anyOf:
|
1703
|
+
- type: string
|
1704
|
+
- type: array
|
1705
|
+
items:
|
1706
|
+
type: string
|
1707
|
+
SchemaTypeIdentifier:
|
1708
|
+
title: Schema Type Identifier
|
1709
|
+
description: (This component is experimental. Use at your own risk.) Identifies schema details for dynamic schema extraction and processing.
|
1710
|
+
type: object
|
1711
|
+
required:
|
1712
|
+
- key_pointer
|
1713
|
+
properties:
|
1714
|
+
type:
|
1715
|
+
type: string
|
1716
|
+
enum: [SchemaTypeIdentifier]
|
1717
|
+
schema_pointer:
|
1718
|
+
title: Schema Path
|
1719
|
+
description: List of nested fields defining the schema field path to extract. Defaults to [].
|
1720
|
+
type: array
|
1721
|
+
default: []
|
1722
|
+
items:
|
1723
|
+
- type: string
|
1724
|
+
interpolation_content:
|
1725
|
+
- config
|
1726
|
+
key_pointer:
|
1727
|
+
title: Key Path
|
1728
|
+
description: List of potentially nested fields describing the full path of the field key to extract.
|
1729
|
+
type: array
|
1730
|
+
items:
|
1731
|
+
- type: string
|
1732
|
+
interpolation_content:
|
1733
|
+
- config
|
1734
|
+
type_pointer:
|
1735
|
+
title: Type Path
|
1736
|
+
description: List of potentially nested fields describing the full path of the field type to extract.
|
1737
|
+
type: array
|
1738
|
+
items:
|
1739
|
+
- type: string
|
1740
|
+
interpolation_content:
|
1741
|
+
- config
|
1742
|
+
types_mapping:
|
1743
|
+
type: array
|
1744
|
+
items:
|
1745
|
+
- "$ref": "#/definitions/TypesMap"
|
1746
|
+
$parameters:
|
1747
|
+
type: object
|
1748
|
+
additionalProperties: true
|
1749
|
+
DynamicSchemaLoader:
|
1750
|
+
title: Dynamic Schema Loader
|
1751
|
+
description: (This component is experimental. Use at your own risk.) Loads a schema by extracting data from retrieved records.
|
1752
|
+
type: object
|
1753
|
+
required:
|
1754
|
+
- type
|
1755
|
+
- retriever
|
1756
|
+
- schema_type_identifier
|
1757
|
+
properties:
|
1758
|
+
type:
|
1759
|
+
type: string
|
1760
|
+
enum: [DynamicSchemaLoader]
|
1761
|
+
retriever:
|
1762
|
+
title: Retriever
|
1763
|
+
description: Component used to coordinate how records are extracted across stream slices and request pages.
|
1764
|
+
anyOf:
|
1765
|
+
- "$ref": "#/definitions/AsyncRetriever"
|
1766
|
+
- "$ref": "#/definitions/CustomRetriever"
|
1767
|
+
- "$ref": "#/definitions/SimpleRetriever"
|
1768
|
+
schema_type_identifier:
|
1769
|
+
"$ref": "#/definitions/SchemaTypeIdentifier"
|
1770
|
+
$parameters:
|
1771
|
+
type: object
|
1772
|
+
additionalProperties: true
|
1679
1773
|
InlineSchemaLoader:
|
1680
1774
|
title: Inline Schema Loader
|
1681
1775
|
description: Loads a schema that is defined directly in the manifest file.
|
@@ -2895,6 +2989,96 @@ definitions:
|
|
2895
2989
|
$parameters:
|
2896
2990
|
type: object
|
2897
2991
|
additionalProperties: true
|
2992
|
+
ComponentMappingDefinition:
|
2993
|
+
title: Component Mapping Definition
|
2994
|
+
description: (This component is experimental. Use at your own risk.) Specifies a mapping definition to update or add fields in a record or configuration. This allows dynamic mapping of data by interpolating values into the template based on provided contexts.
|
2995
|
+
type: object
|
2996
|
+
required:
|
2997
|
+
- type
|
2998
|
+
- field_path
|
2999
|
+
- value
|
3000
|
+
properties:
|
3001
|
+
type:
|
3002
|
+
type: string
|
3003
|
+
enum: [ComponentMappingDefinition]
|
3004
|
+
field_path:
|
3005
|
+
title: Field Path
|
3006
|
+
description: A list of potentially nested fields indicating the full path where value will be added or updated.
|
3007
|
+
type: array
|
3008
|
+
items:
|
3009
|
+
- type: string
|
3010
|
+
interpolation_context:
|
3011
|
+
- config
|
3012
|
+
- components_values
|
3013
|
+
- stream_template_config
|
3014
|
+
examples:
|
3015
|
+
- ["data"]
|
3016
|
+
- ["data", "records"]
|
3017
|
+
- ["data", "{{ parameters.name }}"]
|
3018
|
+
- ["data", "*", "record"]
|
3019
|
+
value:
|
3020
|
+
title: Value
|
3021
|
+
description: The dynamic or static value to assign to the key. Interpolated values can be used to dynamically determine the value during runtime.
|
3022
|
+
type: string
|
3023
|
+
interpolation_context:
|
3024
|
+
- config
|
3025
|
+
- stream_template_config
|
3026
|
+
- components_values
|
3027
|
+
examples:
|
3028
|
+
- "{{ components_values['updates'] }}"
|
3029
|
+
- "{{ components_values['MetaData']['LastUpdatedTime'] }}"
|
3030
|
+
- "{{ config['segment_id'] }}"
|
3031
|
+
value_type:
|
3032
|
+
title: Value Type
|
3033
|
+
description: The expected data type of the value. If omitted, the type will be inferred from the value provided.
|
3034
|
+
"$ref": "#/definitions/ValueType"
|
3035
|
+
$parameters:
|
3036
|
+
type: object
|
3037
|
+
additionalProperties: true
|
3038
|
+
HttpComponentsResolver:
|
3039
|
+
type: object
|
3040
|
+
description: (This component is experimental. Use at your own risk.) Component resolve and populates stream templates with components fetched via an HTTP retriever.
|
3041
|
+
properties:
|
3042
|
+
type:
|
3043
|
+
type: string
|
3044
|
+
enum: [HttpComponentsResolver]
|
3045
|
+
retriever:
|
3046
|
+
title: Retriever
|
3047
|
+
description: Component used to coordinate how records are extracted across stream slices and request pages.
|
3048
|
+
anyOf:
|
3049
|
+
- "$ref": "#/definitions/AsyncRetriever"
|
3050
|
+
- "$ref": "#/definitions/CustomRetriever"
|
3051
|
+
- "$ref": "#/definitions/SimpleRetriever"
|
3052
|
+
components_mapping:
|
3053
|
+
type: array
|
3054
|
+
items:
|
3055
|
+
"$ref": "#/definitions/ComponentMappingDefinition"
|
3056
|
+
$parameters:
|
3057
|
+
type: object
|
3058
|
+
additionalProperties: true
|
3059
|
+
required:
|
3060
|
+
- type
|
3061
|
+
- retriever
|
3062
|
+
- components_mapping
|
3063
|
+
DynamicDeclarativeStream:
|
3064
|
+
type: object
|
3065
|
+
description: (This component is experimental. Use at your own risk.) A component that described how will be created declarative streams based on stream template.
|
3066
|
+
properties:
|
3067
|
+
type:
|
3068
|
+
type: string
|
3069
|
+
enum: [DynamicDeclarativeStream]
|
3070
|
+
stream_template:
|
3071
|
+
title: Stream Template
|
3072
|
+
description: Reference to the stream template.
|
3073
|
+
"$ref": "#/definitions/DeclarativeStream"
|
3074
|
+
components_resolver:
|
3075
|
+
title: Components Resolver
|
3076
|
+
description: Component resolve and populates stream templates with components values.
|
3077
|
+
"$ref": "#/definitions/HttpComponentsResolver"
|
3078
|
+
required:
|
3079
|
+
- type
|
3080
|
+
- stream_template
|
3081
|
+
- components_resolver
|
2898
3082
|
interpolation:
|
2899
3083
|
variables:
|
2900
3084
|
- title: config
|
@@ -39,6 +39,7 @@ from airbyte_cdk.sources.declarative.parsers.manifest_reference_resolver import
|
|
39
39
|
from airbyte_cdk.sources.declarative.parsers.model_to_component_factory import (
|
40
40
|
ModelToComponentFactory,
|
41
41
|
)
|
42
|
+
from airbyte_cdk.sources.declarative.resolvers import COMPONENTS_RESOLVER_TYPE_MAPPING
|
42
43
|
from airbyte_cdk.sources.message import MessageRepository
|
43
44
|
from airbyte_cdk.sources.streams.core import Stream
|
44
45
|
from airbyte_cdk.sources.types import ConnectionDefinition
|
@@ -120,7 +121,10 @@ class ManifestDeclarativeSource(DeclarativeSource):
|
|
120
121
|
self._emit_manifest_debug_message(
|
121
122
|
extra_args={"source_name": self.name, "parsed_config": json.dumps(self._source_config)}
|
122
123
|
)
|
123
|
-
|
124
|
+
|
125
|
+
stream_configs = self._stream_configs(self._source_config) + self._dynamic_stream_configs(
|
126
|
+
self._source_config, config
|
127
|
+
)
|
124
128
|
|
125
129
|
source_streams = [
|
126
130
|
self._constructor.create_component(
|
@@ -234,7 +238,8 @@ class ManifestDeclarativeSource(DeclarativeSource):
|
|
234
238
|
)
|
235
239
|
|
236
240
|
streams = self._source_config.get("streams")
|
237
|
-
|
241
|
+
dynamic_streams = self._source_config.get("dynamic_streams")
|
242
|
+
if not (streams or dynamic_streams):
|
238
243
|
raise ValidationError(
|
239
244
|
f"A valid manifest should have at least one stream defined. Got {streams}"
|
240
245
|
)
|
@@ -303,5 +308,51 @@ class ManifestDeclarativeSource(DeclarativeSource):
|
|
303
308
|
s["type"] = "DeclarativeStream"
|
304
309
|
return stream_configs
|
305
310
|
|
311
|
+
def _dynamic_stream_configs(
|
312
|
+
self, manifest: Mapping[str, Any], config: Mapping[str, Any]
|
313
|
+
) -> List[Dict[str, Any]]:
|
314
|
+
dynamic_stream_definitions: List[Dict[str, Any]] = manifest.get("dynamic_streams", [])
|
315
|
+
dynamic_stream_configs: List[Dict[str, Any]] = []
|
316
|
+
|
317
|
+
for dynamic_definition in dynamic_stream_definitions:
|
318
|
+
components_resolver_config = dynamic_definition["components_resolver"]
|
319
|
+
|
320
|
+
if not components_resolver_config:
|
321
|
+
raise ValueError(
|
322
|
+
f"Missing 'components_resolver' in dynamic definition: {dynamic_definition}"
|
323
|
+
)
|
324
|
+
|
325
|
+
resolver_type = components_resolver_config.get("type")
|
326
|
+
if not resolver_type:
|
327
|
+
raise ValueError(
|
328
|
+
f"Missing 'type' in components resolver configuration: {components_resolver_config}"
|
329
|
+
)
|
330
|
+
|
331
|
+
if resolver_type not in COMPONENTS_RESOLVER_TYPE_MAPPING:
|
332
|
+
raise ValueError(
|
333
|
+
f"Invalid components resolver type '{resolver_type}'. "
|
334
|
+
f"Expected one of {list(COMPONENTS_RESOLVER_TYPE_MAPPING.keys())}."
|
335
|
+
)
|
336
|
+
|
337
|
+
if "retriever" in components_resolver_config:
|
338
|
+
components_resolver_config["retriever"]["requester"]["use_cache"] = True
|
339
|
+
|
340
|
+
# Create a resolver for dynamic components based on type
|
341
|
+
components_resolver = self._constructor.create_component(
|
342
|
+
COMPONENTS_RESOLVER_TYPE_MAPPING[resolver_type], components_resolver_config, config
|
343
|
+
)
|
344
|
+
|
345
|
+
stream_template_config = dynamic_definition["stream_template"]
|
346
|
+
|
347
|
+
for dynamic_stream in components_resolver.resolve_components(
|
348
|
+
stream_template_config=stream_template_config
|
349
|
+
):
|
350
|
+
if "type" not in dynamic_stream:
|
351
|
+
dynamic_stream["type"] = "DeclarativeStream"
|
352
|
+
|
353
|
+
dynamic_stream_configs.append(dynamic_stream)
|
354
|
+
|
355
|
+
return dynamic_stream_configs
|
356
|
+
|
306
357
|
def _emit_manifest_debug_message(self, extra_args: dict[str, Any]) -> None:
|
307
358
|
self.logger.debug("declarative source created from manifest", extra=extra_args)
|
@@ -650,6 +650,32 @@ class HttpResponseFilter(BaseModel):
|
|
650
650
|
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
651
651
|
|
652
652
|
|
653
|
+
class TypesMap(BaseModel):
|
654
|
+
target_type: Union[str, List[str]]
|
655
|
+
current_type: Union[str, List[str]]
|
656
|
+
|
657
|
+
|
658
|
+
class SchemaTypeIdentifier(BaseModel):
|
659
|
+
type: Optional[Literal["SchemaTypeIdentifier"]] = None
|
660
|
+
schema_pointer: Optional[List[str]] = Field(
|
661
|
+
[],
|
662
|
+
description="List of nested fields defining the schema field path to extract. Defaults to [].",
|
663
|
+
title="Schema Path",
|
664
|
+
)
|
665
|
+
key_pointer: List[str] = Field(
|
666
|
+
...,
|
667
|
+
description="List of potentially nested fields describing the full path of the field key to extract.",
|
668
|
+
title="Key Path",
|
669
|
+
)
|
670
|
+
type_pointer: Optional[List[str]] = Field(
|
671
|
+
None,
|
672
|
+
description="List of potentially nested fields describing the full path of the field type to extract.",
|
673
|
+
title="Type Path",
|
674
|
+
)
|
675
|
+
types_mapping: Optional[List[TypesMap]] = None
|
676
|
+
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
677
|
+
|
678
|
+
|
653
679
|
class InlineSchemaLoader(BaseModel):
|
654
680
|
type: Literal["InlineSchemaLoader"]
|
655
681
|
schema_: Optional[Dict[str, Any]] = Field(
|
@@ -822,13 +848,13 @@ class OauthConnectorInputSpecification(BaseModel):
|
|
822
848
|
)
|
823
849
|
extract_output: List[str] = Field(
|
824
850
|
...,
|
825
|
-
description="The DeclarativeOAuth Specific list of strings to indicate which keys should be extracted and returned back to the input config.
|
851
|
+
description="The DeclarativeOAuth Specific list of strings to indicate which keys should be extracted and returned back to the input config.",
|
826
852
|
examples=[{"extract_output": ["access_token", "refresh_token", "other_field"]}],
|
827
853
|
title="DeclarativeOAuth Extract Output",
|
828
854
|
)
|
829
855
|
state: Optional[State] = Field(
|
830
856
|
None,
|
831
|
-
description="The DeclarativeOAuth Specific object to provide the criteria of how the `state` query param should be constructed,\nincluding length and complexity.
|
857
|
+
description="The DeclarativeOAuth Specific object to provide the criteria of how the `state` query param should be constructed,\nincluding length and complexity.",
|
832
858
|
examples=[{"state": {"min": 7, "max": 128}}],
|
833
859
|
title="(Optional) DeclarativeOAuth Configurable State Query Param",
|
834
860
|
)
|
@@ -852,13 +878,13 @@ class OauthConnectorInputSpecification(BaseModel):
|
|
852
878
|
)
|
853
879
|
state_key: Optional[str] = Field(
|
854
880
|
None,
|
855
|
-
description="The DeclarativeOAuth Specific optional override to provide the custom `state` key name, if required by data-provider.
|
881
|
+
description="The DeclarativeOAuth Specific optional override to provide the custom `state` key name, if required by data-provider.",
|
856
882
|
examples=[{"state_key": "my_custom_state_key_key_name"}],
|
857
883
|
title="(Optional) DeclarativeOAuth State Key Override",
|
858
884
|
)
|
859
885
|
auth_code_key: Optional[str] = Field(
|
860
886
|
None,
|
861
|
-
description="The DeclarativeOAuth Specific optional override to provide the custom `code` key name to something like `auth_code` or `custom_auth_code`, if required by data-provider.
|
887
|
+
description="The DeclarativeOAuth Specific optional override to provide the custom `code` key name to something like `auth_code` or `custom_auth_code`, if required by data-provider.",
|
862
888
|
examples=[{"auth_code_key": "my_custom_auth_code_key_name"}],
|
863
889
|
title="(Optional) DeclarativeOAuth Auth Code Key Override",
|
864
890
|
)
|
@@ -1158,6 +1184,37 @@ class WaitUntilTimeFromHeader(BaseModel):
|
|
1158
1184
|
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
1159
1185
|
|
1160
1186
|
|
1187
|
+
class ComponentMappingDefinition(BaseModel):
|
1188
|
+
type: Literal["ComponentMappingDefinition"]
|
1189
|
+
field_path: List[str] = Field(
|
1190
|
+
...,
|
1191
|
+
description="A list of potentially nested fields indicating the full path where value will be added or updated.",
|
1192
|
+
examples=[
|
1193
|
+
["data"],
|
1194
|
+
["data", "records"],
|
1195
|
+
["data", "{{ parameters.name }}"],
|
1196
|
+
["data", "*", "record"],
|
1197
|
+
],
|
1198
|
+
title="Field Path",
|
1199
|
+
)
|
1200
|
+
value: str = Field(
|
1201
|
+
...,
|
1202
|
+
description="The dynamic or static value to assign to the key. Interpolated values can be used to dynamically determine the value during runtime.",
|
1203
|
+
examples=[
|
1204
|
+
"{{ components_values['updates'] }}",
|
1205
|
+
"{{ components_values['MetaData']['LastUpdatedTime'] }}",
|
1206
|
+
"{{ config['segment_id'] }}",
|
1207
|
+
],
|
1208
|
+
title="Value",
|
1209
|
+
)
|
1210
|
+
value_type: Optional[ValueType] = Field(
|
1211
|
+
None,
|
1212
|
+
description="The expected data type of the value. If omitted, the type will be inferred from the value provided.",
|
1213
|
+
title="Value Type",
|
1214
|
+
)
|
1215
|
+
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
1216
|
+
|
1217
|
+
|
1161
1218
|
class AddedFieldDefinition(BaseModel):
|
1162
1219
|
type: Literal["AddedFieldDefinition"]
|
1163
1220
|
path: List[str] = Field(
|
@@ -1455,13 +1512,14 @@ class CompositeErrorHandler(BaseModel):
|
|
1455
1512
|
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
1456
1513
|
|
1457
1514
|
|
1458
|
-
class
|
1515
|
+
class DeclarativeSource1(BaseModel):
|
1459
1516
|
class Config:
|
1460
1517
|
extra = Extra.forbid
|
1461
1518
|
|
1462
1519
|
type: Literal["DeclarativeSource"]
|
1463
1520
|
check: CheckStream
|
1464
1521
|
streams: List[DeclarativeStream]
|
1522
|
+
dynamic_streams: Optional[List[DynamicDeclarativeStream]] = None
|
1465
1523
|
version: str = Field(
|
1466
1524
|
...,
|
1467
1525
|
description="The version of the Airbyte CDK used to build and test the source.",
|
@@ -1480,6 +1538,43 @@ class DeclarativeSource(BaseModel):
|
|
1480
1538
|
)
|
1481
1539
|
|
1482
1540
|
|
1541
|
+
class DeclarativeSource2(BaseModel):
|
1542
|
+
class Config:
|
1543
|
+
extra = Extra.forbid
|
1544
|
+
|
1545
|
+
type: Literal["DeclarativeSource"]
|
1546
|
+
check: CheckStream
|
1547
|
+
streams: Optional[List[DeclarativeStream]] = None
|
1548
|
+
dynamic_streams: List[DynamicDeclarativeStream]
|
1549
|
+
version: str = Field(
|
1550
|
+
...,
|
1551
|
+
description="The version of the Airbyte CDK used to build and test the source.",
|
1552
|
+
)
|
1553
|
+
schemas: Optional[Schemas] = None
|
1554
|
+
definitions: Optional[Dict[str, Any]] = None
|
1555
|
+
spec: Optional[Spec] = None
|
1556
|
+
concurrency_level: Optional[ConcurrencyLevel] = None
|
1557
|
+
metadata: Optional[Dict[str, Any]] = Field(
|
1558
|
+
None,
|
1559
|
+
description="For internal Airbyte use only - DO NOT modify manually. Used by consumers of declarative manifests for storing related metadata.",
|
1560
|
+
)
|
1561
|
+
description: Optional[str] = Field(
|
1562
|
+
None,
|
1563
|
+
description="A description of the connector. It will be presented on the Source documentation page.",
|
1564
|
+
)
|
1565
|
+
|
1566
|
+
|
1567
|
+
class DeclarativeSource(BaseModel):
|
1568
|
+
class Config:
|
1569
|
+
extra = Extra.forbid
|
1570
|
+
|
1571
|
+
__root__: Union[DeclarativeSource1, DeclarativeSource2] = Field(
|
1572
|
+
...,
|
1573
|
+
description="An API source that extracts data according to its declarative components.",
|
1574
|
+
title="DeclarativeSource",
|
1575
|
+
)
|
1576
|
+
|
1577
|
+
|
1483
1578
|
class SelectiveAuthenticator(BaseModel):
|
1484
1579
|
class Config:
|
1485
1580
|
extra = Extra.allow
|
@@ -1705,6 +1800,17 @@ class HttpRequester(BaseModel):
|
|
1705
1800
|
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
1706
1801
|
|
1707
1802
|
|
1803
|
+
class DynamicSchemaLoader(BaseModel):
|
1804
|
+
type: Literal["DynamicSchemaLoader"]
|
1805
|
+
retriever: Union[AsyncRetriever, CustomRetriever, SimpleRetriever] = Field(
|
1806
|
+
...,
|
1807
|
+
description="Component used to coordinate how records are extracted across stream slices and request pages.",
|
1808
|
+
title="Retriever",
|
1809
|
+
)
|
1810
|
+
schema_type_identifier: SchemaTypeIdentifier
|
1811
|
+
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
1812
|
+
|
1813
|
+
|
1708
1814
|
class ParentStreamConfig(BaseModel):
|
1709
1815
|
type: Literal["ParentStreamConfig"]
|
1710
1816
|
parent_key: str = Field(
|
@@ -1883,10 +1989,35 @@ class SubstreamPartitionRouter(BaseModel):
|
|
1883
1989
|
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
1884
1990
|
|
1885
1991
|
|
1992
|
+
class HttpComponentsResolver(BaseModel):
|
1993
|
+
type: Literal["HttpComponentsResolver"]
|
1994
|
+
retriever: Union[AsyncRetriever, CustomRetriever, SimpleRetriever] = Field(
|
1995
|
+
...,
|
1996
|
+
description="Component used to coordinate how records are extracted across stream slices and request pages.",
|
1997
|
+
title="Retriever",
|
1998
|
+
)
|
1999
|
+
components_mapping: List[ComponentMappingDefinition]
|
2000
|
+
parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
|
2001
|
+
|
2002
|
+
|
2003
|
+
class DynamicDeclarativeStream(BaseModel):
|
2004
|
+
type: Literal["DynamicDeclarativeStream"]
|
2005
|
+
stream_template: DeclarativeStream = Field(
|
2006
|
+
..., description="Reference to the stream template.", title="Stream Template"
|
2007
|
+
)
|
2008
|
+
components_resolver: HttpComponentsResolver = Field(
|
2009
|
+
...,
|
2010
|
+
description="Component resolve and populates stream templates with components values.",
|
2011
|
+
title="Components Resolver",
|
2012
|
+
)
|
2013
|
+
|
2014
|
+
|
1886
2015
|
CompositeErrorHandler.update_forward_refs()
|
1887
|
-
|
2016
|
+
DeclarativeSource1.update_forward_refs()
|
2017
|
+
DeclarativeSource2.update_forward_refs()
|
1888
2018
|
SelectiveAuthenticator.update_forward_refs()
|
1889
2019
|
DeclarativeStream.update_forward_refs()
|
1890
2020
|
SessionTokenAuthenticator.update_forward_refs()
|
2021
|
+
DynamicSchemaLoader.update_forward_refs()
|
1891
2022
|
SimpleRetriever.update_forward_refs()
|
1892
2023
|
AsyncRetriever.update_forward_refs()
|
@@ -31,6 +31,12 @@ DEFAULT_MODEL_TYPES: Mapping[str, str] = {
|
|
31
31
|
# DeclarativeStream
|
32
32
|
"DeclarativeStream.retriever": "SimpleRetriever",
|
33
33
|
"DeclarativeStream.schema_loader": "JsonFileSchemaLoader",
|
34
|
+
# DynamicDeclarativeStream
|
35
|
+
"DynamicDeclarativeStream.stream_template": "DeclarativeStream",
|
36
|
+
"DynamicDeclarativeStream.components_resolver": "HttpComponentsResolver",
|
37
|
+
# HttpComponentsResolver
|
38
|
+
"HttpComponentsResolver.retriever": "SimpleRetriever",
|
39
|
+
"HttpComponentsResolver.components_mapping": "ComponentMappingDefinition",
|
34
40
|
# DefaultErrorHandler
|
35
41
|
"DefaultErrorHandler.response_filters": "HttpResponseFilter",
|
36
42
|
# DefaultPaginator
|
@@ -58,6 +64,10 @@ DEFAULT_MODEL_TYPES: Mapping[str, str] = {
|
|
58
64
|
"AddFields.fields": "AddedFieldDefinition",
|
59
65
|
# CustomPartitionRouter
|
60
66
|
"CustomPartitionRouter.parent_stream_configs": "ParentStreamConfig",
|
67
|
+
# DynamicSchemaLoader
|
68
|
+
"DynamicSchemaLoader.retriever": "SimpleRetriever",
|
69
|
+
# SchemaTypeIdentifier
|
70
|
+
"SchemaTypeIdentifier.types_map": "TypesMap",
|
61
71
|
}
|
62
72
|
|
63
73
|
# We retain a separate registry for custom components to automatically insert the type if it is missing. This is intended to
|