|
204 | 204 | from airbyte_cdk.sources.declarative.models.declarative_component_schema import ( |
205 | 205 | DeclarativeStream as DeclarativeStreamModel, |
206 | 206 | ) |
207 | | -from airbyte_cdk.sources.declarative.models.declarative_component_schema import ( |
208 | | - StateDelegatingStream as StateDelegatingStreamModel, |
209 | | -) |
210 | 207 | from airbyte_cdk.sources.declarative.models.declarative_component_schema import ( |
211 | 208 | DefaultErrorHandler as DefaultErrorHandlerModel, |
212 | 209 | ) |
|
355 | 352 | SimpleRetriever as SimpleRetrieverModel, |
356 | 353 | ) |
357 | 354 | from airbyte_cdk.sources.declarative.models.declarative_component_schema import Spec as SpecModel |
| 355 | +from airbyte_cdk.sources.declarative.models.declarative_component_schema import ( |
| 356 | + StateDelegatingStream as StateDelegatingStreamModel, |
| 357 | +) |
358 | 358 | from airbyte_cdk.sources.declarative.models.declarative_component_schema import ( |
359 | 359 | StreamConfig as StreamConfigModel, |
360 | 360 | ) |
@@ -1793,13 +1793,17 @@ def _build_stream_slicer_from_partition_router( |
1793 | 1793 | if isinstance(stream_slicer_model, list): |
1794 | 1794 | return CartesianProductStreamSlicer( |
1795 | 1795 | [ |
1796 | | - self._create_component_from_model(model=slicer, config=config, stream_name=stream_name or "") |
| 1796 | + self._create_component_from_model( |
| 1797 | + model=slicer, config=config, stream_name=stream_name or "" |
| 1798 | + ) |
1797 | 1799 | for slicer in stream_slicer_model |
1798 | 1800 | ], |
1799 | 1801 | parameters={}, |
1800 | 1802 | ) |
1801 | 1803 | else: |
1802 | | - return self._create_component_from_model(model=stream_slicer_model, config=config, stream_name=stream_name or "") # type: ignore[no-any-return] # Will be created PartitionRouter as stream_slicer_model is model.partition_router |
| 1804 | + return self._create_component_from_model( |
| 1805 | + model=stream_slicer_model, config=config, stream_name=stream_name or "" |
| 1806 | + ) # type: ignore[no-any-return] # Will be created PartitionRouter as stream_slicer_model is model.partition_router |
1803 | 1807 | return None |
1804 | 1808 |
|
1805 | 1809 | def _build_incremental_cursor( |
@@ -2478,7 +2482,9 @@ def create_page_increment( |
2478 | 2482 | def create_parent_stream_config( |
2479 | 2483 | self, model: ParentStreamConfigModel, config: Config, **kwargs: Any |
2480 | 2484 | ) -> ParentStreamConfig: |
2481 | | - declarative_stream = self._create_component_from_model(model.stream, config=config, **kwargs) |
| 2485 | + declarative_stream = self._create_component_from_model( |
| 2486 | + model.stream, config=config, **kwargs |
| 2487 | + ) |
2482 | 2488 | request_option = ( |
2483 | 2489 | self._create_component_from_model(model.request_option, config=config) |
2484 | 2490 | if model.request_option |
@@ -2719,12 +2725,26 @@ def create_simple_retriever( |
2719 | 2725 | parameters=model.parameters or {}, |
2720 | 2726 | ) |
2721 | 2727 |
|
2722 | | - def create_state_delegating_stream(self, model: StateDelegatingStreamModel, config: Config, child_state: Optional[MutableMapping[str, Any]] = None, **kwargs: Any |
| 2728 | + def create_state_delegating_stream( |
| 2729 | + self, |
| 2730 | + model: StateDelegatingStreamModel, |
| 2731 | + config: Config, |
| 2732 | + child_state: Optional[MutableMapping[str, Any]] = None, |
| 2733 | + **kwargs: Any, |
2723 | 2734 | ) -> DeclarativeStream: |
2724 | | - if model.full_refresh_stream.name != model.name or model.name != model.incremental_stream.name: |
2725 | | - raise ValueError(f"state_delegating_stream, full_refresh_stream name and incremental_stream must have equal names. Instead has {model.name}, {model.full_refresh_stream.name} and {model.incremental_stream.name}.") |
| 2735 | + if ( |
| 2736 | + model.full_refresh_stream.name != model.name |
| 2737 | + or model.name != model.incremental_stream.name |
| 2738 | + ): |
| 2739 | + raise ValueError( |
| 2740 | + f"state_delegating_stream, full_refresh_stream name and incremental_stream must have equal names. Instead has {model.name}, {model.full_refresh_stream.name} and {model.incremental_stream.name}." |
| 2741 | + ) |
2726 | 2742 |
|
2727 | | - stream_model = model.incremental_stream if self._connector_state_manager.get_stream_state(model.name, None) or child_state else model.full_refresh_stream |
| 2743 | + stream_model = ( |
| 2744 | + model.incremental_stream |
| 2745 | + if self._connector_state_manager.get_stream_state(model.name, None) or child_state |
| 2746 | + else model.full_refresh_stream |
| 2747 | + ) |
2728 | 2748 |
|
2729 | 2749 | return self._create_component_from_model(stream_model, config=config, **kwargs) # type: ignore[no-any-return] # Will be created DeclarativeStream as stream_model is stream description |
2730 | 2750 |
|
@@ -2981,8 +3001,14 @@ def _create_message_repository_substream_wrapper( |
2981 | 3001 | self._evaluate_log_level(self._emit_connector_builder_messages), |
2982 | 3002 | ), |
2983 | 3003 | ) |
2984 | | - child_state = self._connector_state_manager.get_stream_state(kwargs.get("stream_name", ""), None) if model.incremental_dependency or False else None |
2985 | | - return substream_factory._create_component_from_model(model=model, config=config, child_state=child_state, **kwargs) |
| 3004 | + child_state = ( |
| 3005 | + self._connector_state_manager.get_stream_state(kwargs.get("stream_name", ""), None) |
| 3006 | + if model.incremental_dependency or False |
| 3007 | + else None |
| 3008 | + ) |
| 3009 | + return substream_factory._create_component_from_model( |
| 3010 | + model=model, config=config, child_state=child_state, **kwargs |
| 3011 | + ) |
2986 | 3012 |
|
2987 | 3013 | @staticmethod |
2988 | 3014 | def create_wait_time_from_header( |
|
0 commit comments