3535from airbyte_cdk .connector_builder .models import (
3636 LogMessage as ConnectorBuilderLogMessage ,
3737)
38- from airbyte_cdk .legacy .sources .declarative .declarative_stream import DeclarativeStream
39- from airbyte_cdk .legacy .sources .declarative .incremental import (
40- DatetimeBasedCursor ,
41- )
4238from airbyte_cdk .models import (
4339 AirbyteStateBlob ,
4440 AirbyteStateMessage ,
@@ -740,7 +736,6 @@ def _init_mappings(self) -> None:
740736 CustomTransformationModel : self .create_custom_component ,
741737 CustomValidationStrategyModel : self .create_custom_component ,
742738 CustomConfigTransformationModel : self .create_custom_component ,
743- DatetimeBasedCursorModel : self .create_datetime_based_cursor ,
744739 DeclarativeStreamModel : self .create_default_stream ,
745740 DefaultErrorHandlerModel : self .create_default_error_handler ,
746741 DefaultPaginatorModel : self .create_default_paginator ,
@@ -763,7 +758,6 @@ def _init_mappings(self) -> None:
763758 FlattenFieldsModel : self .create_flatten_fields ,
764759 DpathFlattenFieldsModel : self .create_dpath_flatten_fields ,
765760 IterableDecoderModel : self .create_iterable_decoder ,
766- IncrementingCountCursorModel : self .create_incrementing_count_cursor ,
767761 XmlDecoderModel : self .create_xml_decoder ,
768762 JsonFileSchemaLoaderModel : self .create_json_file_schema_loader ,
769763 DynamicSchemaLoaderModel : self .create_dynamic_schema_loader ,
@@ -1931,64 +1925,6 @@ def _create_nested_component(
19311925 def _is_component (model_value : Any ) -> bool :
19321926 return isinstance (model_value , dict ) and model_value .get ("type" ) is not None
19331927
1934- def create_datetime_based_cursor (
1935- self , model : DatetimeBasedCursorModel , config : Config , ** kwargs : Any
1936- ) -> DatetimeBasedCursor :
1937- start_datetime : Union [str , MinMaxDatetime ] = (
1938- model .start_datetime
1939- if isinstance (model .start_datetime , str )
1940- else self .create_min_max_datetime (model .start_datetime , config )
1941- )
1942- end_datetime : Union [str , MinMaxDatetime , None ] = None
1943- if model .is_data_feed and model .end_datetime :
1944- raise ValueError ("Data feed does not support end_datetime" )
1945- if model .is_data_feed and model .is_client_side_incremental :
1946- raise ValueError (
1947- "`Client side incremental` cannot be applied with `data feed`. Choose only 1 from them."
1948- )
1949- if model .end_datetime :
1950- end_datetime = (
1951- model .end_datetime
1952- if isinstance (model .end_datetime , str )
1953- else self .create_min_max_datetime (model .end_datetime , config )
1954- )
1955-
1956- end_time_option = (
1957- self ._create_component_from_model (
1958- model .end_time_option , config , parameters = model .parameters or {}
1959- )
1960- if model .end_time_option
1961- else None
1962- )
1963- start_time_option = (
1964- self ._create_component_from_model (
1965- model .start_time_option , config , parameters = model .parameters or {}
1966- )
1967- if model .start_time_option
1968- else None
1969- )
1970-
1971- return DatetimeBasedCursor (
1972- cursor_field = model .cursor_field ,
1973- cursor_datetime_formats = model .cursor_datetime_formats
1974- if model .cursor_datetime_formats
1975- else [],
1976- cursor_granularity = model .cursor_granularity ,
1977- datetime_format = model .datetime_format ,
1978- end_datetime = end_datetime ,
1979- start_datetime = start_datetime ,
1980- step = model .step ,
1981- end_time_option = end_time_option ,
1982- lookback_window = model .lookback_window ,
1983- start_time_option = start_time_option ,
1984- partition_field_end = model .partition_field_end ,
1985- partition_field_start = model .partition_field_start ,
1986- message_repository = self ._message_repository ,
1987- is_compare_strictly = model .is_compare_strictly ,
1988- config = config ,
1989- parameters = model .parameters or {},
1990- )
1991-
19921928 def create_default_stream (
19931929 self , model : DeclarativeStreamModel , config : Config , is_parent : bool = False , ** kwargs : Any
19941930 ) -> AbstractStream :
@@ -2652,24 +2588,6 @@ def create_gzip_decoder(
26522588 fallback_parser = gzip_parser .inner_parser ,
26532589 )
26542590
2655- # todo: This method should be removed once we deprecate the SimpleRetriever.cursor field and the various
2656- # state methods
2657- @staticmethod
2658- def create_incrementing_count_cursor (
2659- model : IncrementingCountCursorModel , config : Config , ** kwargs : Any
2660- ) -> DatetimeBasedCursor :
2661- # This should not actually get used anywhere at runtime, but needed to add this to pass checks since
2662- # we still parse models into components. The issue is that there's no runtime implementation of a
2663- # IncrementingCountCursor.
2664- # A known and expected issue with this stub is running a check with the declared IncrementingCountCursor because it is run without ConcurrentCursor.
2665- return DatetimeBasedCursor (
2666- cursor_field = model .cursor_field ,
2667- datetime_format = "%Y-%m-%d" ,
2668- start_datetime = "2024-12-12" ,
2669- config = config ,
2670- parameters = {},
2671- )
2672-
26732591 @staticmethod
26742592 def create_iterable_decoder (
26752593 model : IterableDecoderModel , config : Config , ** kwargs : Any
@@ -3451,7 +3369,6 @@ def _get_url(req: Requester) -> str:
34513369 record_selector = record_selector ,
34523370 stream_slicer = _NO_STREAM_SLICING ,
34533371 request_option_provider = request_options_provider ,
3454- cursor = None ,
34553372 config = config ,
34563373 ignore_stream_slicer_parameters_on_paginated_requests = ignore_stream_slicer_parameters_on_paginated_requests ,
34573374 parameters = model .parameters or {},
@@ -3472,7 +3389,6 @@ def _get_url(req: Requester) -> str:
34723389 record_selector = record_selector ,
34733390 stream_slicer = _NO_STREAM_SLICING ,
34743391 request_option_provider = request_options_provider ,
3475- cursor = None ,
34763392 config = config ,
34773393 ignore_stream_slicer_parameters_on_paginated_requests = ignore_stream_slicer_parameters_on_paginated_requests ,
34783394 additional_query_properties = query_properties ,
@@ -3565,7 +3481,7 @@ def create_state_delegating_stream(
35653481 config : Config ,
35663482 has_parent_state : Optional [bool ] = None ,
35673483 ** kwargs : Any ,
3568- ) -> DeclarativeStream :
3484+ ) -> DefaultStream :
35693485 if (
35703486 model .full_refresh_stream .name != model .name
35713487 or model .name != model .incremental_stream .name
0 commit comments