airbyte-cdk 6.20.0__py3-none-any.whl → 6.20.1__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.
@@ -1788,6 +1788,10 @@ definitions:
1788
1788
  - type: array
1789
1789
  items:
1790
1790
  type: string
1791
+ condition:
1792
+ type: string
1793
+ interpolation_context:
1794
+ - raw_schema
1791
1795
  SchemaTypeIdentifier:
1792
1796
  title: Schema Type Identifier
1793
1797
  description: (This component is experimental. Use at your own risk.) Identifies schema details for dynamic schema extraction and processing.
@@ -719,6 +719,7 @@ class HttpResponseFilter(BaseModel):
719
719
  class TypesMap(BaseModel):
720
720
  target_type: Union[str, List[str]]
721
721
  current_type: Union[str, List[str]]
722
+ condition: Optional[str]
722
723
 
723
724
 
724
725
  class SchemaTypeIdentifier(BaseModel):
@@ -1696,7 +1696,11 @@ class ModelToComponentFactory:
1696
1696
 
1697
1697
  @staticmethod
1698
1698
  def create_types_map(model: TypesMapModel, **kwargs: Any) -> TypesMap:
1699
- return TypesMap(target_type=model.target_type, current_type=model.current_type)
1699
+ return TypesMap(
1700
+ target_type=model.target_type,
1701
+ current_type=model.current_type,
1702
+ condition=model.condition if model.condition is not None else "True",
1703
+ )
1700
1704
 
1701
1705
  def create_schema_type_identifier(
1702
1706
  self, model: SchemaTypeIdentifierModel, config: Config, **kwargs: Any
@@ -10,6 +10,7 @@ from typing import Any, List, Mapping, MutableMapping, Optional, Union
10
10
  import dpath
11
11
  from typing_extensions import deprecated
12
12
 
13
+ from airbyte_cdk.sources.declarative.interpolation.interpolated_boolean import InterpolatedBoolean
13
14
  from airbyte_cdk.sources.declarative.interpolation.interpolated_string import InterpolatedString
14
15
  from airbyte_cdk.sources.declarative.retrievers.retriever import Retriever
15
16
  from airbyte_cdk.sources.declarative.schema.schema_loader import SchemaLoader
@@ -53,6 +54,7 @@ class TypesMap:
53
54
 
54
55
  target_type: Union[List[str], str]
55
56
  current_type: Union[List[str], str]
57
+ condition: Optional[str]
56
58
 
57
59
 
58
60
  @deprecated("This class is experimental. Use at your own risk.", category=ExperimentalClassWarning)
@@ -177,7 +179,7 @@ class DynamicSchemaLoader(SchemaLoader):
177
179
  if field_type_path
178
180
  else "string"
179
181
  )
180
- mapped_field_type = self._replace_type_if_not_valid(raw_field_type)
182
+ mapped_field_type = self._replace_type_if_not_valid(raw_field_type, raw_schema)
181
183
  if (
182
184
  isinstance(mapped_field_type, list)
183
185
  and len(mapped_field_type) == 2
@@ -194,14 +196,22 @@ class DynamicSchemaLoader(SchemaLoader):
194
196
  )
195
197
 
196
198
  def _replace_type_if_not_valid(
197
- self, field_type: Union[List[str], str]
199
+ self,
200
+ field_type: Union[List[str], str],
201
+ raw_schema: MutableMapping[str, Any],
198
202
  ) -> Union[List[str], str]:
199
203
  """
200
204
  Replaces a field type if it matches a type mapping in `types_map`.
201
205
  """
202
206
  if self.schema_type_identifier.types_mapping:
203
207
  for types_map in self.schema_type_identifier.types_mapping:
204
- if field_type == types_map.current_type:
208
+ # conditional is optional param, setting to true if not provided
209
+ condition = InterpolatedBoolean(
210
+ condition=types_map.condition if types_map.condition is not None else "True",
211
+ parameters={},
212
+ ).eval(config=self.config, raw_schema=raw_schema)
213
+
214
+ if field_type == types_map.current_type and condition:
205
215
  return types_map.target_type
206
216
  return field_type
207
217
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: airbyte-cdk
3
- Version: 6.20.0
3
+ Version: 6.20.1
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  License: MIT
6
6
  Keywords: airbyte,connector-development-kit,cdk
@@ -67,7 +67,7 @@ airbyte_cdk/sources/declarative/concurrent_declarative_source.py,sha256=tSTCSmyM
67
67
  airbyte_cdk/sources/declarative/datetime/__init__.py,sha256=l9LG7Qm6e5r_qgqfVKnx3mXYtg1I9MmMjomVIPfU4XA,177
68
68
  airbyte_cdk/sources/declarative/datetime/datetime_parser.py,sha256=SX9JjdesN1edN2WVUVMzU_ptqp2QB1OnsnjZ4mwcX7w,2579
69
69
  airbyte_cdk/sources/declarative/datetime/min_max_datetime.py,sha256=0BHBtDNQZfvwM45-tY5pNlTcKAFSGGNxemoi0Jic-0E,5785
70
- airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=fdrKoQkRUSJwS_k2xRxWTiXqwQv7jmM8mdEfdrnmdnc,136006
70
+ airbyte_cdk/sources/declarative/declarative_component_schema.yaml,sha256=JR_papKSYoUZC0YozAN4iTZuW7OKTeKPQP_DdZsKU_I,136098
71
71
  airbyte_cdk/sources/declarative/declarative_source.py,sha256=nF7wBqFd3AQmEKAm4CnIo29CJoQL562cJGSCeL8U8bA,1531
72
72
  airbyte_cdk/sources/declarative/declarative_stream.py,sha256=JRyNeOIpsFu4ztVZsN6sncqUEIqIE-bUkD2TPgbMgk0,10375
73
73
  airbyte_cdk/sources/declarative/decoders/__init__.py,sha256=edGj4fGxznBk4xzRQyCA1rGfbpqe7z-RE0K3kQQWbgA,858
@@ -107,12 +107,12 @@ airbyte_cdk/sources/declarative/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW
107
107
  airbyte_cdk/sources/declarative/migrations/legacy_to_per_partition_state_migration.py,sha256=iemy3fKLczcU0-Aor7tx5jcT6DRedKMqyK7kCOp01hg,3924
108
108
  airbyte_cdk/sources/declarative/migrations/state_migration.py,sha256=KWPjealMLKSMtajXgkdGgKg7EmTLR-CqqD7UIh0-eDU,794
109
109
  airbyte_cdk/sources/declarative/models/__init__.py,sha256=nUFxNCiKeYRVXuZEKA7GD-lTHxsiKcQ8FitZjKhPIvE,100
110
- airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=vdFgGfWWLGU9aQ9NK0f_g8r0FUkhV76kj3MsmDSzBT4,95776
110
+ airbyte_cdk/sources/declarative/models/declarative_component_schema.py,sha256=Gif9VFysx-c6m1LJqmNpIterZ6crFyAytePTZZhqtpc,95805
111
111
  airbyte_cdk/sources/declarative/parsers/__init__.py,sha256=ZnqYNxHsKCgO38IwB34RQyRMXTs4GTvlRi3ImKnIioo,61
112
112
  airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=Rir9_z3Kcd5Es0-LChrzk-0qubAsiK_RSEnLmK2OXm8,553
113
113
  airbyte_cdk/sources/declarative/parsers/manifest_component_transformer.py,sha256=CXwTfD3wSQq3okcqwigpprbHhSURUokh4GK2OmOyKC8,9132
114
114
  airbyte_cdk/sources/declarative/parsers/manifest_reference_resolver.py,sha256=IWUOdF03o-aQn0Occo1BJCxU0Pz-QILk5L67nzw2thw,6803
115
- airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=2GL54eoIQUvZbQVTnFED42dLdSfu6zYM1eMcOzImCyk,112189
115
+ airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=-rkDtlbDWtdhKNB1xD6HgK38Uq38b9oKuA_zh1YvTO8,112306
116
116
  airbyte_cdk/sources/declarative/partition_routers/__init__.py,sha256=HJ-Syp3p7RpyR_OK0X_a2kSyISfu3W-PKrRI16iY0a8,957
117
117
  airbyte_cdk/sources/declarative/partition_routers/async_job_partition_router.py,sha256=n82J15S8bjeMZ5uROu--P3hnbQoxkY5v7RPHYx7g7ro,2929
118
118
  airbyte_cdk/sources/declarative/partition_routers/cartesian_product_stream_slicer.py,sha256=c5cuVFM6NFkuQqG8Z5IwkBuwDrvXZN1CunUOM_L0ezg,6892
@@ -167,7 +167,7 @@ airbyte_cdk/sources/declarative/retrievers/retriever.py,sha256=XPLs593Xv8c5cKMc3
167
167
  airbyte_cdk/sources/declarative/retrievers/simple_retriever.py,sha256=jxQ_9xcVD07r9PKhofitAqMkdX1k8ZNyy50qz5NwkFs,24540
168
168
  airbyte_cdk/sources/declarative/schema/__init__.py,sha256=HztgVVaZdil5UfgUZcv_Hyy84r89_EKRwyO2hoewNVg,749
169
169
  airbyte_cdk/sources/declarative/schema/default_schema_loader.py,sha256=KTACrIE23a83wsm3Rd9Eb4K6-20lrGqYxTHNp9yxsso,1820
170
- airbyte_cdk/sources/declarative/schema/dynamic_schema_loader.py,sha256=H6A3NQ6kPPM-cUNPmdvDPc9xNzR1rQNrK95GbgCW334,8822
170
+ airbyte_cdk/sources/declarative/schema/dynamic_schema_loader.py,sha256=sa99VqU1U45fgZL2qEdw8ueX1tPTPfGxibQ-ZFePjSM,9361
171
171
  airbyte_cdk/sources/declarative/schema/inline_schema_loader.py,sha256=bVETE10hRsatRJq3R3BeyRR0wIoK3gcP1gcpVRQ_P5U,464
172
172
  airbyte_cdk/sources/declarative/schema/json_file_schema_loader.py,sha256=5Wl-fqW-pVf_dxJ4yGHMAFfC4JjKHYJhqFJT1xA57F4,4177
173
173
  airbyte_cdk/sources/declarative/schema/schema_loader.py,sha256=kjt8v0N5wWKA5zyLnrDLxf1PJKdUqvQq2RVnAOAzNSY,379
@@ -344,8 +344,8 @@ airbyte_cdk/utils/slice_hasher.py,sha256=-pHexlNYoWYPnXNH-M7HEbjmeJe9Zk7SJijdQ7d
344
344
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
345
345
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
346
346
  airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
347
- airbyte_cdk-6.20.0.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
348
- airbyte_cdk-6.20.0.dist-info/METADATA,sha256=mJ9CtFNvum2UmCz2OOr9aMcPRFbtgCsYiD5siTNUgnU,6000
349
- airbyte_cdk-6.20.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
350
- airbyte_cdk-6.20.0.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
351
- airbyte_cdk-6.20.0.dist-info/RECORD,,
347
+ airbyte_cdk-6.20.1.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
348
+ airbyte_cdk-6.20.1.dist-info/METADATA,sha256=v6NwQSfbvaLEacCvookkp82DipX0fR09nStYrbKM17E,6000
349
+ airbyte_cdk-6.20.1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
350
+ airbyte_cdk-6.20.1.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
351
+ airbyte_cdk-6.20.1.dist-info/RECORD,,