airbyte-cdk 6.59.2__py3-none-any.whl → 6.60.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.
@@ -4173,6 +4173,18 @@ definitions:
4173
4173
  description: Determines whether to create a new path if it doesn't exist (true) or only update existing paths (false). When set to true, the resolver will create new paths in the stream template if they don't exist. When false (default), it will only update existing paths.
4174
4174
  type: boolean
4175
4175
  default: false
4176
+ condition:
4177
+ title: Condition
4178
+ description: A condition that must be met for the mapping to be applied. This property is only supported for `ConfigComponentsResolver`.
4179
+ type: string
4180
+ interpolation_context:
4181
+ - config
4182
+ - stream_template_config
4183
+ - components_values
4184
+ - stream_slice
4185
+ examples:
4186
+ - "{{ components_values.get('cursor_field', None) }}"
4187
+ - "{{ '_incremental' in components_values.get('stream_name', '') }}"
4176
4188
  $parameters:
4177
4189
  type: object
4178
4190
  additionalProperties: true
@@ -1,3 +1,5 @@
1
+ # Copyright (c) 2025 Airbyte, Inc., all rights reserved.
2
+
1
3
  # generated by datamodel-codegen:
2
4
  # filename: declarative_component_schema.yaml
3
5
 
@@ -1492,6 +1494,15 @@ class ComponentMappingDefinition(BaseModel):
1492
1494
  description="Determines whether to create a new path if it doesn't exist (true) or only update existing paths (false). When set to true, the resolver will create new paths in the stream template if they don't exist. When false (default), it will only update existing paths.",
1493
1495
  title="Create or Update",
1494
1496
  )
1497
+ condition: Optional[str] = Field(
1498
+ None,
1499
+ description="A condition that must be met for the mapping to be applied. This property is only supported for `ConfigComponentsResolver`.",
1500
+ examples=[
1501
+ "{{ components_values.get('cursor_field', None) }}",
1502
+ "{{ '_incremental' in components_values.get('stream_name', '') }}",
1503
+ ],
1504
+ title="Condition",
1505
+ )
1495
1506
  parameters: Optional[Dict[str, Any]] = Field(None, alias="$parameters")
1496
1507
 
1497
1508
 
@@ -3800,6 +3800,7 @@ class ModelToComponentFactory:
3800
3800
  value=interpolated_value,
3801
3801
  value_type=ModelToComponentFactory._json_schema_type_name_to_type(model.value_type),
3802
3802
  create_or_update=model.create_or_update,
3803
+ condition=model.condition,
3803
3804
  parameters=model.parameters or {},
3804
3805
  )
3805
3806
 
@@ -3818,16 +3819,19 @@ class ModelToComponentFactory:
3818
3819
  transformations=[],
3819
3820
  )
3820
3821
 
3821
- components_mapping = [
3822
- self._create_component_from_model(
3823
- model=components_mapping_definition_model,
3824
- value_type=ModelToComponentFactory._json_schema_type_name_to_type(
3825
- components_mapping_definition_model.value_type
3826
- ),
3827
- config=config,
3822
+ components_mapping = []
3823
+ for component_mapping_definition_model in model.components_mapping:
3824
+ if component_mapping_definition_model.condition:
3825
+ raise ValueError("`condition` is only supported for `ConfigComponentsResolver`")
3826
+ components_mapping.append(
3827
+ self._create_component_from_model(
3828
+ model=component_mapping_definition_model,
3829
+ value_type=ModelToComponentFactory._json_schema_type_name_to_type(
3830
+ component_mapping_definition_model.value_type
3831
+ ),
3832
+ config=config,
3833
+ )
3828
3834
  )
3829
- for components_mapping_definition_model in model.components_mapping
3830
- ]
3831
3835
 
3832
3836
  return HttpComponentsResolver(
3833
3837
  retriever=retriever,
@@ -3851,7 +3855,9 @@ class ModelToComponentFactory:
3851
3855
  )
3852
3856
 
3853
3857
  def create_config_components_resolver(
3854
- self, model: ConfigComponentsResolverModel, config: Config
3858
+ self,
3859
+ model: ConfigComponentsResolverModel,
3860
+ config: Config,
3855
3861
  ) -> Any:
3856
3862
  model_stream_configs = (
3857
3863
  model.stream_config if isinstance(model.stream_config, list) else [model.stream_config]
@@ -3871,6 +3877,7 @@ class ModelToComponentFactory:
3871
3877
  components_mapping_definition_model.value_type
3872
3878
  ),
3873
3879
  config=config,
3880
+ parameters=model.parameters,
3874
3881
  )
3875
3882
  for components_mapping_definition_model in model.components_mapping
3876
3883
  ]
@@ -3888,16 +3895,20 @@ class ModelToComponentFactory:
3888
3895
  stream_parameters = StreamParametersDefinition(
3889
3896
  list_of_parameters_for_stream=model.stream_parameters.list_of_parameters_for_stream
3890
3897
  )
3891
- components_mapping = [
3892
- self._create_component_from_model(
3893
- model=components_mapping_definition_model,
3894
- value_type=ModelToComponentFactory._json_schema_type_name_to_type(
3895
- components_mapping_definition_model.value_type
3896
- ),
3897
- config=config,
3898
+
3899
+ components_mapping = []
3900
+ for components_mapping_definition_model in model.components_mapping:
3901
+ if components_mapping_definition_model.condition:
3902
+ raise ValueError("`condition` is only supported for `ConfigComponentsResolver`")
3903
+ components_mapping.append(
3904
+ self._create_component_from_model(
3905
+ model=components_mapping_definition_model,
3906
+ value_type=ModelToComponentFactory._json_schema_type_name_to_type(
3907
+ components_mapping_definition_model.value_type
3908
+ ),
3909
+ config=config,
3910
+ )
3898
3911
  )
3899
- for components_mapping_definition_model in model.components_mapping
3900
- ]
3901
3912
  return ParametrizedComponentsResolver(
3902
3913
  stream_parameters=stream_parameters,
3903
3914
  config=config,
@@ -9,6 +9,7 @@ from typing import Any, Dict, Iterable, List, Mapping, Optional, Type, Union
9
9
  from typing_extensions import deprecated
10
10
 
11
11
  from airbyte_cdk.sources.declarative.interpolation import InterpolatedString
12
+ from airbyte_cdk.sources.declarative.interpolation.interpolated_boolean import InterpolatedBoolean
12
13
  from airbyte_cdk.sources.source import ExperimentalClassWarning
13
14
 
14
15
 
@@ -22,6 +23,7 @@ class ComponentMappingDefinition:
22
23
  value: Union["InterpolatedString", str]
23
24
  value_type: Optional[Type[Any]]
24
25
  parameters: InitVar[Mapping[str, Any]]
26
+ condition: Optional[str] = None
25
27
  create_or_update: Optional[bool] = False
26
28
 
27
29
 
@@ -35,6 +37,7 @@ class ResolvedComponentMappingDefinition:
35
37
  value: "InterpolatedString"
36
38
  value_type: Optional[Type[Any]]
37
39
  parameters: InitVar[Mapping[str, Any]]
40
+ condition: Optional[InterpolatedBoolean] = None
38
41
  create_or_update: Optional[bool] = False
39
42
 
40
43
 
@@ -14,6 +14,7 @@ from yaml.parser import ParserError
14
14
  from yaml.scanner import ScannerError
15
15
 
16
16
  from airbyte_cdk.sources.declarative.interpolation import InterpolatedString
17
+ from airbyte_cdk.sources.declarative.interpolation.interpolated_boolean import InterpolatedBoolean
17
18
  from airbyte_cdk.sources.declarative.resolvers.components_resolver import (
18
19
  ComponentMappingDefinition,
19
20
  ComponentsResolver,
@@ -70,6 +71,12 @@ class ConfigComponentsResolver(ComponentsResolver):
70
71
  """
71
72
 
72
73
  for component_mapping in self.components_mapping:
74
+ interpolated_condition = (
75
+ InterpolatedBoolean(condition=component_mapping.condition, parameters=parameters)
76
+ if component_mapping.condition
77
+ else None
78
+ )
79
+
73
80
  if isinstance(component_mapping.value, (str, InterpolatedString)):
74
81
  interpolated_value = (
75
82
  InterpolatedString.create(component_mapping.value, parameters=parameters)
@@ -89,6 +96,7 @@ class ConfigComponentsResolver(ComponentsResolver):
89
96
  value_type=component_mapping.value_type,
90
97
  create_or_update=component_mapping.create_or_update,
91
98
  parameters=parameters,
99
+ condition=interpolated_condition,
92
100
  )
93
101
  )
94
102
  else:
@@ -155,6 +163,12 @@ class ConfigComponentsResolver(ComponentsResolver):
155
163
  kwargs["components_values"] = components_values # type: ignore[assignment] # component_values will always be of type Mapping[str, Any]
156
164
 
157
165
  for resolved_component in self._resolved_components:
166
+ if (
167
+ resolved_component.condition is not None
168
+ and not resolved_component.condition.eval(self.config, **kwargs)
169
+ ):
170
+ continue
171
+
158
172
  valid_types = (
159
173
  (resolved_component.value_type,) if resolved_component.value_type else None
160
174
  )
@@ -64,6 +64,11 @@ class AirbyteEntrypointException(Exception):
64
64
  raise output.as_exception()
65
65
  """
66
66
 
67
+ message: str = ""
68
+
69
+ def __post_init__(self) -> None:
70
+ super().__init__(self.message)
71
+
67
72
 
68
73
  class EntrypointOutput:
69
74
  """A class to encapsulate the output of an Airbyte connector's execution.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.59.2
3
+ Version: 6.60.0
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -90,7 +90,7 @@ airbyte_cdk/sources/declarative/concurrent_declarative_source.py,sha256=rQz9gXp3
90
90
  airbyte_cdk/sources/declarative/datetime/__init__.py,sha256=4Hw-PX1-VgESLF16cDdvuYCzGJtHntThLF4qIiULWeo,61
91
91
  airbyte_cdk/sources/declarative/datetime/datetime_parser.py,sha256=_zGNGq31RNy_0QBLt_EcTvgPyhj7urPdx6oA3M5-r3o,3150
92
92
  airbyte_cdk/sources/declarative/datetime/min_max_datetime.py,sha256=0BHBtDNQZfvwM45-tY5pNlTcKAFSGGNxemoi0Jic-0E,5785
93
- airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=tGte90Y3mTtsdyT5nUNgxBgV-CD9Nk_zrMU0mL1M3DE,186143
93
+ airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=FlHXxlxEtiLZTmZ826aijk1bkUC167wa-qO3YOD4eWw,186652
94
94
  airbyte_cdk/sources/declarative/declarative_source.py,sha256=qmyMnnet92eGc3C22yBtpvD5UZjqdhsAafP_zxI5wp8,1814
95
95
  airbyte_cdk/sources/declarative/declarative_stream.py,sha256=dCRlddBUSaJmBNBz1pSO1r2rTw8AP5d2_vlmIeGs2gg,10767
96
96
  airbyte_cdk/sources/declarative/decoders/__init__.py,sha256=JHb_0d3SE6kNY10mxA5YBEKPeSbsWYjByq1gUQxepoE,953
@@ -134,14 +134,14 @@ airbyte_cdk/sources/declarative/migrations/legacy_to_per_partition_state_migrati
134
134
  airbyte_cdk/sources/declarative/migrations/state_migration.py,sha256=KWPjealMLKSMtajXgkdGgKg7EmTLR-CqqD7UIh0-eDU,794
135
135
  airbyte_cdk/sources/declarative/models/__init__.py,sha256=nUFxNCiKeYRVXuZEKA7GD-lTHxsiKcQ8FitZjKhPIvE,100
136
136
  airbyte_cdk/sources/declarative/models/base_model_with_deprecations.py,sha256=Imnj3yef0aqRdLfaUxkIYISUb8YkiPrRH_wBd-x8HjM,5999
137
- airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=5M8q0qBoFTIqyHXs5RniGyMDurDgODZ0Ad_OuIhpdio,131664
137
+ airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=HjCMwAUm_EyRNeafeNMA3Sx1uIOf-RZgtpueY0Li_vE,132129
138
138
  airbyte_cdk/sources/declarative/parsers/__init__.py,sha256=ZnqYNxHsKCgO38IwB34RQyRMXTs4GTvlRi3ImKnIioo,61
139
139
  airbyte_cdk/sources/declarative/parsers/custom_code_compiler.py,sha256=nlVvHC511NUyDEEIRBkoeDTAvLqKNp-hRy8D19z8tdk,5941
140
140
  airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=wnRUP0Xeru9Rbu5OexXSDN9QWDo8YU4tT9M2LDVOgGA,802
141
141
  airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py,sha256=2UdpCz3yi7ISZTyqkQXSSy3dMxeyOWqV7OlAS5b9GVg,11568
142
142
  airbyte_cdk/sources/declarative/parsers/manifest_normalizer.py,sha256=EtKjS9c94yNp3AwQC8KUCQaAYW5T3zvFYxoWYjc_buI,19729
143
143
  airbyte_cdk/sources/declarative/parsers/manifest_reference_resolver.py,sha256=pJmg78vqE5VfUrF_KJnWjucQ4k9IWFULeAxHCowrHXE,6806
144
- airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=r2-PV4O2f1vXDO-Nrrdin5wZEnaCC9o3Y3fKRqphsr4,177527
144
+ airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=kmteSTmgLsUwMkR6K2HQPTRgLZ4W_CZXsAraFg8IRQ4,178085
145
145
  airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=TBC9AkGaUqHm2IKHMPN6punBIcY5tWGULowcLoAVkfw,1109
146
146
  airbyte_cdk/sources/declarative/partition_routers/async_job_partition_router.py,sha256=VelO7zKqKtzMJ35jyFeg0ypJLQC0plqqIBNXoBW1G2E,3001
147
147
  airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slicer.py,sha256=c5cuVFM6NFkuQqG8Z5IwkBuwDrvXZN1CunUOM_L0ezg,6892
@@ -195,8 +195,8 @@ airbyte_cdk/sources/declarative/requesters/request_options/request_options_provi
195
195
  airbyte_cdk/sources/declarative/requesters/request_path.py,sha256=S3MeFvcaQrMbOkSY2W2VbXLNomqt_3eXqVd9ZhgNwUs,299
196
196
  airbyte_cdk/sources/declarative/requesters/requester.py,sha256=T6tMx_Bx4iT-0YVjY7IzgRil-gaIu9n01b1iwpTh3Ek,5516
197
197
  airbyte_cdk/sources/declarative/resolvers/__init__.py,sha256=xVhOWLQW0wFBTAtRYu3GdFebPqKCDSt1uoP2TiBGrvs,1643
198
- airbyte_cdk/sources/declarative/resolvers/components_resolver.py,sha256=oJIpy66ep8n-QOc8GwpllApTRcl4QtQhkTw5fWWra2w,2026
199
- airbyte_cdk/sources/declarative/resolvers/config_components_resolver.py,sha256=PBLSxQ7rD69j-RaHVKiXw9xW4mxrMeX6y7vCnlHfg60,7810
198
+ airbyte_cdk/sources/declarative/resolvers/components_resolver.py,sha256=rkNatGGhPQhasor95CujY7StmVn5q2UDGAcEzMKueGE,2213
199
+ airbyte_cdk/sources/declarative/resolvers/config_components_resolver.py,sha256=OqL3Xil-2905pNfGwE-uPtEu53ksnT99Aec91cu5eSM,8408
200
200
  airbyte_cdk/sources/declarative/resolvers/http_components_resolver.py,sha256=AiojNs8wItJFrENZBFUaDvau3sgwudO6Wkra36upSPo,4639
201
201
  airbyte_cdk/sources/declarative/resolvers/parametrized_components_resolver.py,sha256=BUmvbsMeIGusZSCd80NiTFcwcosq-uhXHGNheAFs-10,5147
202
202
  airbyte_cdk/sources/declarative/retrievers/__init__.py,sha256=LQQspOQS9oyOx9cGnRIz1mq-8DZCBysyDJDPqjy1HvM,449
@@ -380,7 +380,7 @@ airbyte_cdk/sql/shared/sql_processor.py,sha256=jR-hdLZsPf2sNBa_wvWKLvys8ZJ-SQCIi
380
380
  airbyte_cdk/sql/types.py,sha256=XEIhRAo_ASd0kVLBkdLf5bHiRhNple-IJrC9TibcDdY,5880
381
381
  airbyte_cdk/test/__init__.py,sha256=f_XdkOg4_63QT2k3BbKY34209lppwgw-svzfZstQEq4,199
382
382
  airbyte_cdk/test/catalog_builder.py,sha256=-y05Cz1x0Dlk6oE9LSKhCozssV2gYBNtMdV5YYOPOtk,3015
383
- airbyte_cdk/test/entrypoint_wrapper.py,sha256=wNxoUP8lUIc_8-owLF9SlzLgkH6yH_Bsow8K0wLRB5I,17889
383
+ airbyte_cdk/test/entrypoint_wrapper.py,sha256=0t76VgYLHO1W-s0bjZCutd3smp2DR44ahwTFo5ydkM8,17989
384
384
  airbyte_cdk/test/mock_http/__init__.py,sha256=jE5kC6CQ0OXkTqKhciDnNVZHesBFVIA2YvkdFGwva7k,322
385
385
  airbyte_cdk/test/mock_http/matcher.py,sha256=4Qj8UnJKZIs-eodshryce3SN1Ayc8GZpBETmP6hTEyc,1446
386
386
  airbyte_cdk/test/mock_http/mocker.py,sha256=XgsjMtVoeMpRELPyALgrkHFauH9H5irxrz1Kcxh2yFY,8013
@@ -424,9 +424,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
424
424
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
425
425
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
426
426
  airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
427
- airbyte_cdk-6.59.2.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
428
- airbyte_cdk-6.59.2.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
429
- airbyte_cdk-6.59.2.dist-info/METADATA,sha256=v-WEUpwObclpURlDpPC98g6GMfs_9Xl8gdL6KGpctos,6477
430
- airbyte_cdk-6.59.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
431
- airbyte_cdk-6.59.2.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
432
- airbyte_cdk-6.59.2.dist-info/RECORD,,
427
+ airbyte_cdk-6.60.0.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
428
+ airbyte_cdk-6.60.0.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
429
+ airbyte_cdk-6.60.0.dist-info/METADATA,sha256=7rqP7Rfw-t--oR0jX1QpDlvLlMLRExIhryx3Uy90zBo,6477
430
+ airbyte_cdk-6.60.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
431
+ airbyte_cdk-6.60.0.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
432
+ airbyte_cdk-6.60.0.dist-info/RECORD,,