airbyte-cdk 6.60.14__py3-none-any.whl → 6.60.16__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/parsers/model_to_component_factory.py +62 -45
- {airbyte_cdk-6.60.14.dist-info → airbyte_cdk-6.60.16.dist-info}/METADATA +1 -1
- {airbyte_cdk-6.60.14.dist-info → airbyte_cdk-6.60.16.dist-info}/RECORD +7 -7
- {airbyte_cdk-6.60.14.dist-info → airbyte_cdk-6.60.16.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-6.60.14.dist-info → airbyte_cdk-6.60.16.dist-info}/LICENSE_SHORT +0 -0
- {airbyte_cdk-6.60.14.dist-info → airbyte_cdk-6.60.16.dist-info}/WHEEL +0 -0
- {airbyte_cdk-6.60.14.dist-info → airbyte_cdk-6.60.16.dist-info}/entry_points.txt +0 -0
@@ -94,16 +94,13 @@ from airbyte_cdk.sources.declarative.extractors.record_filter import (
|
|
94
94
|
ClientSideIncrementalRecordFilterDecorator,
|
95
95
|
)
|
96
96
|
from airbyte_cdk.sources.declarative.incremental import (
|
97
|
-
ChildPartitionResumableFullRefreshCursor,
|
98
97
|
ConcurrentCursorFactory,
|
99
98
|
ConcurrentPerPartitionCursor,
|
100
99
|
CursorFactory,
|
101
100
|
DatetimeBasedCursor,
|
102
101
|
DeclarativeCursor,
|
103
102
|
GlobalSubstreamCursor,
|
104
|
-
PerPartitionCursor,
|
105
103
|
PerPartitionWithGlobalCursor,
|
106
|
-
ResumableFullRefreshCursor,
|
107
104
|
)
|
108
105
|
from airbyte_cdk.sources.declarative.interpolation import InterpolatedString
|
109
106
|
from airbyte_cdk.sources.declarative.interpolation.interpolated_mapping import InterpolatedMapping
|
@@ -446,10 +443,6 @@ from airbyte_cdk.sources.declarative.models.declarative_component_schema import
|
|
446
443
|
from airbyte_cdk.sources.declarative.models.declarative_component_schema import (
|
447
444
|
ZipfileDecoder as ZipfileDecoderModel,
|
448
445
|
)
|
449
|
-
from airbyte_cdk.sources.declarative.parsers.custom_code_compiler import (
|
450
|
-
COMPONENTS_MODULE_NAME,
|
451
|
-
SDM_COMPONENTS_MODULE_NAME,
|
452
|
-
)
|
453
446
|
from airbyte_cdk.sources.declarative.partition_routers import (
|
454
447
|
CartesianProductStreamSlicer,
|
455
448
|
GroupingPartitionRouter,
|
@@ -508,7 +501,7 @@ from airbyte_cdk.sources.declarative.requesters.request_options import (
|
|
508
501
|
RequestOptionsProvider,
|
509
502
|
)
|
510
503
|
from airbyte_cdk.sources.declarative.requesters.request_path import RequestPath
|
511
|
-
from airbyte_cdk.sources.declarative.requesters.requester import HttpMethod
|
504
|
+
from airbyte_cdk.sources.declarative.requesters.requester import HttpMethod
|
512
505
|
from airbyte_cdk.sources.declarative.resolvers import (
|
513
506
|
ComponentMappingDefinition,
|
514
507
|
ConfigComponentsResolver,
|
@@ -617,6 +610,9 @@ from airbyte_cdk.sources.streams.concurrent.cursor import (
|
|
617
610
|
)
|
618
611
|
from airbyte_cdk.sources.streams.concurrent.default_stream import DefaultStream
|
619
612
|
from airbyte_cdk.sources.streams.concurrent.helpers import get_primary_key_from_stream
|
613
|
+
from airbyte_cdk.sources.streams.concurrent.partitions.stream_slicer import (
|
614
|
+
StreamSlicer as ConcurrentStreamSlicer,
|
615
|
+
)
|
620
616
|
from airbyte_cdk.sources.streams.concurrent.state_converters.datetime_stream_state_converter import (
|
621
617
|
CustomFormatConcurrentStreamStateConverter,
|
622
618
|
DateTimeStreamStateConverter,
|
@@ -1933,29 +1929,7 @@ class ModelToComponentFactory:
|
|
1933
1929
|
def create_declarative_stream(
|
1934
1930
|
self, model: DeclarativeStreamModel, config: Config, is_parent: bool = False, **kwargs: Any
|
1935
1931
|
) -> Union[DeclarativeStream, AbstractStream]:
|
1936
|
-
# When constructing a declarative stream, we assemble the incremental_sync component and retriever's partition_router field
|
1937
|
-
# components if they exist into a single CartesianProductStreamSlicer. This is then passed back as an argument when constructing the
|
1938
|
-
# Retriever. This is done in the declarative stream not the retriever to support custom retrievers. The custom create methods in
|
1939
|
-
# the factory only support passing arguments to the component constructors, whereas this performs a merge of all slicers into one.
|
1940
|
-
combined_slicers = self._merge_stream_slicers(model=model, config=config)
|
1941
|
-
|
1942
1932
|
primary_key = model.primary_key.__root__ if model.primary_key else None
|
1943
|
-
stop_condition_on_cursor = (
|
1944
|
-
model.incremental_sync
|
1945
|
-
and hasattr(model.incremental_sync, "is_data_feed")
|
1946
|
-
and model.incremental_sync.is_data_feed
|
1947
|
-
)
|
1948
|
-
client_side_filtering_enabled = (
|
1949
|
-
model.incremental_sync
|
1950
|
-
and hasattr(model.incremental_sync, "is_client_side_incremental")
|
1951
|
-
and model.incremental_sync.is_client_side_incremental
|
1952
|
-
)
|
1953
|
-
concurrent_cursor = None
|
1954
|
-
if stop_condition_on_cursor or client_side_filtering_enabled:
|
1955
|
-
stream_slicer = self._build_stream_slicer_from_partition_router(
|
1956
|
-
model.retriever, config, stream_name=model.name
|
1957
|
-
)
|
1958
|
-
concurrent_cursor = self._build_concurrent_cursor(model, stream_slicer, config)
|
1959
1933
|
|
1960
1934
|
if model.incremental_sync and isinstance(model.incremental_sync, DatetimeBasedCursorModel):
|
1961
1935
|
cursor_model = model.incremental_sync
|
@@ -2023,6 +1997,15 @@ class ModelToComponentFactory:
|
|
2023
1997
|
model=model.file_uploader, config=config
|
2024
1998
|
)
|
2025
1999
|
|
2000
|
+
# When constructing a declarative stream, we assemble the incremental_sync component and retriever's partition_router field
|
2001
|
+
# components if they exist into a single CartesianProductStreamSlicer. This is then passed back as an argument when constructing the
|
2002
|
+
# Retriever. This is done in the declarative stream not the retriever to support custom retrievers. The custom create methods in
|
2003
|
+
# the factory only support passing arguments to the component constructors, whereas this performs a merge of all slicers into one.
|
2004
|
+
combined_slicers = self._merge_stream_slicers(model=model, config=config)
|
2005
|
+
partition_router = self._build_stream_slicer_from_partition_router(
|
2006
|
+
model.retriever, config, stream_name=model.name
|
2007
|
+
)
|
2008
|
+
concurrent_cursor = self._build_concurrent_cursor(model, partition_router, config)
|
2026
2009
|
retriever = self._create_component_from_model(
|
2027
2010
|
model=model.retriever,
|
2028
2011
|
config=config,
|
@@ -2030,9 +2013,11 @@ class ModelToComponentFactory:
|
|
2030
2013
|
primary_key=primary_key,
|
2031
2014
|
stream_slicer=combined_slicers,
|
2032
2015
|
request_options_provider=request_options_provider,
|
2033
|
-
stop_condition_cursor=concurrent_cursor
|
2016
|
+
stop_condition_cursor=concurrent_cursor
|
2017
|
+
if self._is_stop_condition_on_cursor(model)
|
2018
|
+
else None,
|
2034
2019
|
client_side_incremental_sync={"cursor": concurrent_cursor}
|
2035
|
-
if
|
2020
|
+
if self._is_client_side_filtering_enabled(model)
|
2036
2021
|
else None,
|
2037
2022
|
transformations=transformations,
|
2038
2023
|
file_uploader=file_uploader,
|
@@ -2066,18 +2051,41 @@ class ModelToComponentFactory:
|
|
2066
2051
|
schema_loader = DefaultSchemaLoader(config=config, parameters=options)
|
2067
2052
|
|
2068
2053
|
if (
|
2069
|
-
|
2054
|
+
(
|
2055
|
+
isinstance(combined_slicers, PartitionRouter)
|
2056
|
+
or isinstance(concurrent_cursor, ConcurrentCursor)
|
2057
|
+
)
|
2070
2058
|
and not self._emit_connector_builder_messages
|
2071
2059
|
and not is_parent
|
2072
2060
|
):
|
2073
2061
|
# We are starting to migrate streams to instantiate directly the DefaultStream instead of instantiating the
|
2074
2062
|
# DeclarativeStream and assembling the DefaultStream from that. The plan is the following:
|
2075
2063
|
# * Streams without partition router nor cursors and streams with only partition router. This is the `isinstance(combined_slicers, PartitionRouter)` condition as the first kind with have a SinglePartitionRouter
|
2076
|
-
# * Streams without partition router but with cursor
|
2064
|
+
# * Streams without partition router but with cursor. This is the `isinstance(concurrent_cursor, ConcurrentCursor)` condition
|
2077
2065
|
# * Streams with both partition router and cursor
|
2078
2066
|
# We specifically exclude parent streams here because SubstreamPartitionRouter has not been updated yet
|
2079
2067
|
# We specifically exclude Connector Builder stuff for now as Brian is working on this anyway
|
2068
|
+
|
2080
2069
|
stream_name = model.name or ""
|
2070
|
+
stream_slicer: ConcurrentStreamSlicer = (
|
2071
|
+
concurrent_cursor if concurrent_cursor else SinglePartitionRouter(parameters={})
|
2072
|
+
)
|
2073
|
+
cursor: Cursor = FinalStateCursor(stream_name, None, self._message_repository)
|
2074
|
+
if isinstance(retriever, AsyncRetriever):
|
2075
|
+
# The AsyncRetriever only ever worked with a cursor from the concurrent package. Hence, the method
|
2076
|
+
# `_build_incremental_cursor` which we would usually think would return only declarative stuff has a
|
2077
|
+
# special clause and return a concurrent cursor. This stream slicer is passed to AsyncRetriever when
|
2078
|
+
# built because the async retriever has a specific partition router which relies on this stream slicer.
|
2079
|
+
# We can't re-use `concurrent_cursor` because it is a different instance than the one passed in
|
2080
|
+
# AsyncJobPartitionRouter.
|
2081
|
+
stream_slicer = retriever.stream_slicer
|
2082
|
+
if isinstance(combined_slicers, Cursor):
|
2083
|
+
cursor = combined_slicers
|
2084
|
+
elif isinstance(combined_slicers, PartitionRouter):
|
2085
|
+
stream_slicer = combined_slicers
|
2086
|
+
elif concurrent_cursor:
|
2087
|
+
cursor = concurrent_cursor
|
2088
|
+
|
2081
2089
|
partition_generator = StreamSlicerPartitionGenerator(
|
2082
2090
|
DeclarativePartitionFactory(
|
2083
2091
|
stream_name,
|
@@ -2085,24 +2093,19 @@ class ModelToComponentFactory:
|
|
2085
2093
|
retriever,
|
2086
2094
|
self._message_repository,
|
2087
2095
|
),
|
2088
|
-
stream_slicer=
|
2089
|
-
StreamSlicer,
|
2090
|
-
StreamSlicerTestReadDecorator(
|
2091
|
-
wrapped_slicer=combined_slicers,
|
2092
|
-
maximum_number_of_slices=self._limit_slices_fetched or 5,
|
2093
|
-
),
|
2094
|
-
),
|
2096
|
+
stream_slicer=stream_slicer,
|
2095
2097
|
)
|
2096
2098
|
return DefaultStream(
|
2097
2099
|
partition_generator=partition_generator,
|
2098
2100
|
name=stream_name,
|
2099
2101
|
json_schema=schema_loader.get_json_schema,
|
2100
2102
|
primary_key=get_primary_key_from_stream(primary_key),
|
2101
|
-
cursor_field=
|
2102
|
-
|
2103
|
+
cursor_field=cursor.cursor_field.cursor_field_key
|
2104
|
+
if hasattr(cursor, "cursor_field")
|
2105
|
+
else "", # FIXME we should have the cursor field has part of the interface of cursor,
|
2103
2106
|
logger=logging.getLogger(f"airbyte.{stream_name}"),
|
2104
|
-
# FIXME this is a breaking change compared to the old implementation
|
2105
|
-
cursor=
|
2107
|
+
# FIXME this is a breaking change compared to the old implementation which used the source name instead
|
2108
|
+
cursor=cursor,
|
2106
2109
|
supports_file_transfer=hasattr(model, "file_uploader")
|
2107
2110
|
and bool(model.file_uploader),
|
2108
2111
|
)
|
@@ -2126,6 +2129,20 @@ class ModelToComponentFactory:
|
|
2126
2129
|
parameters=model.parameters or {},
|
2127
2130
|
)
|
2128
2131
|
|
2132
|
+
def _is_stop_condition_on_cursor(self, model: DeclarativeStreamModel) -> bool:
|
2133
|
+
return bool(
|
2134
|
+
model.incremental_sync
|
2135
|
+
and hasattr(model.incremental_sync, "is_data_feed")
|
2136
|
+
and model.incremental_sync.is_data_feed
|
2137
|
+
)
|
2138
|
+
|
2139
|
+
def _is_client_side_filtering_enabled(self, model: DeclarativeStreamModel) -> bool:
|
2140
|
+
return bool(
|
2141
|
+
model.incremental_sync
|
2142
|
+
and hasattr(model.incremental_sync, "is_client_side_incremental")
|
2143
|
+
and model.incremental_sync.is_client_side_incremental
|
2144
|
+
)
|
2145
|
+
|
2129
2146
|
def _build_stream_slicer_from_partition_router(
|
2130
2147
|
self,
|
2131
2148
|
model: Union[
|
@@ -141,7 +141,7 @@ airbyte_cdk/sources/declarative/parsers/custom_exceptions.py,sha256=wnRUP0Xeru9R
|
|
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=
|
144
|
+
airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py,sha256=D6QD6SxN17Fq_oX-ai8YSzI1WXsChplgcIjwDq9v-A0,184337
|
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
|
@@ -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.60.
|
428
|
-
airbyte_cdk-6.60.
|
429
|
-
airbyte_cdk-6.60.
|
430
|
-
airbyte_cdk-6.60.
|
431
|
-
airbyte_cdk-6.60.
|
432
|
-
airbyte_cdk-6.60.
|
427
|
+
airbyte_cdk-6.60.16.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
428
|
+
airbyte_cdk-6.60.16.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
|
429
|
+
airbyte_cdk-6.60.16.dist-info/METADATA,sha256=y4Lq957WOfoSOasIGdatfeOaeADM_P78JzrfvFwSubc,6478
|
430
|
+
airbyte_cdk-6.60.16.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
431
|
+
airbyte_cdk-6.60.16.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
|
432
|
+
airbyte_cdk-6.60.16.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|