|
5 | 5 | import logging |
6 | 6 | from dataclasses import dataclass, field |
7 | 7 | from queue import Queue |
8 | | -from typing import Any, ClassVar, Generic, Iterator, List, Mapping, MutableMapping, Optional, Tuple |
| 8 | +from typing import ( |
| 9 | + Any, |
| 10 | + ClassVar, |
| 11 | + Generic, |
| 12 | + Iterator, |
| 13 | + List, |
| 14 | + Mapping, |
| 15 | + MutableMapping, |
| 16 | + Optional, |
| 17 | + Tuple, |
| 18 | + Union, |
| 19 | +) |
9 | 20 |
|
10 | 21 | from airbyte_protocol_dataclasses.models import Level |
11 | 22 |
|
|
19 | 30 | from airbyte_cdk.sources.connector_state_manager import ConnectorStateManager |
20 | 31 | from airbyte_cdk.sources.declarative.concurrency_level import ConcurrencyLevel |
21 | 32 | from airbyte_cdk.sources.declarative.declarative_stream import DeclarativeStream |
22 | | -from airbyte_cdk.sources.declarative.extractors import RecordSelector |
23 | | -from airbyte_cdk.sources.declarative.extractors.record_filter import ( |
24 | | - ClientSideIncrementalRecordFilterDecorator, |
25 | | -) |
26 | 33 | from airbyte_cdk.sources.declarative.incremental import ( |
27 | 34 | ConcurrentPerPartitionCursor, |
28 | 35 | GlobalSubstreamCursor, |
|
32 | 39 | PerPartitionWithGlobalCursor, |
33 | 40 | ) |
34 | 41 | from airbyte_cdk.sources.declarative.manifest_declarative_source import ManifestDeclarativeSource |
35 | | -from airbyte_cdk.sources.declarative.models import FileUploader |
36 | 42 | from airbyte_cdk.sources.declarative.models.declarative_component_schema import ( |
37 | 43 | ConcurrencyLevel as ConcurrencyLevelModel, |
38 | 44 | ) |
@@ -117,7 +123,6 @@ def __init__( |
117 | 123 | # incremental streams running in full refresh. |
118 | 124 | component_factory = ModelToComponentFactory( |
119 | 125 | emit_connector_builder_messages=emit_connector_builder_messages, |
120 | | - disable_resumable_full_refresh=True, |
121 | 126 | message_repository=ConcurrentMessageRepository(queue, message_repository), |
122 | 127 | connector_state_manager=self._connector_state_manager, |
123 | 128 | max_concurrent_async_job_count=source_config.get("max_concurrent_async_job_count"), |
@@ -223,7 +228,7 @@ def discover(self, logger: logging.Logger, config: Mapping[str, Any]) -> Airbyte |
223 | 228 | ] |
224 | 229 | ) |
225 | 230 |
|
226 | | - def streams(self, config: Mapping[str, Any]) -> List[Stream]: |
| 231 | + def streams(self, config: Mapping[str, Any]) -> List[Union[Stream, AbstractStream]]: # type: ignore # we are migrating away from the AbstractSource and are expecting that this will only be called by ConcurrentDeclarativeSource or the Connector Builder |
227 | 232 | """ |
228 | 233 | The `streams` method is used as part of the AbstractSource in the following cases: |
229 | 234 | * ConcurrentDeclarativeSource.check -> ManifestDeclarativeSource.check -> AbstractSource.check -> DeclarativeSource.check_connection -> CheckStream.check_connection -> streams |
@@ -253,6 +258,10 @@ def _group_streams( |
253 | 258 | # these legacy Python streams the way we do low-code streams to determine if they are concurrent compatible, |
254 | 259 | # so we need to treat them as synchronous |
255 | 260 |
|
| 261 | + if isinstance(declarative_stream, AbstractStream): |
| 262 | + concurrent_streams.append(declarative_stream) |
| 263 | + continue |
| 264 | + |
256 | 265 | supports_file_transfer = ( |
257 | 266 | isinstance(declarative_stream, DeclarativeStream) |
258 | 267 | and "file_uploader" in name_to_stream_mapping[declarative_stream.name] |
@@ -322,7 +331,7 @@ def _group_streams( |
322 | 331 | partition_generator = StreamSlicerPartitionGenerator( |
323 | 332 | partition_factory=DeclarativePartitionFactory( |
324 | 333 | stream_name=declarative_stream.name, |
325 | | - json_schema=declarative_stream.get_json_schema(), |
| 334 | + schema_loader=declarative_stream._schema_loader, # type: ignore # We are accessing the private property but the public one is optional and we will remove this code soonish |
326 | 335 | retriever=retriever, |
327 | 336 | message_repository=self.message_repository, |
328 | 337 | max_records_limit=self._limits.max_records |
@@ -359,7 +368,7 @@ def _group_streams( |
359 | 368 | partition_generator = StreamSlicerPartitionGenerator( |
360 | 369 | partition_factory=DeclarativePartitionFactory( |
361 | 370 | stream_name=declarative_stream.name, |
362 | | - json_schema=declarative_stream.get_json_schema(), |
| 371 | + schema_loader=declarative_stream._schema_loader, # type: ignore # We are accessing the private property but the public one is optional and we will remove this code soonish |
363 | 372 | retriever=retriever, |
364 | 373 | message_repository=self.message_repository, |
365 | 374 | max_records_limit=self._limits.max_records |
@@ -393,7 +402,7 @@ def _group_streams( |
393 | 402 | partition_generator = StreamSlicerPartitionGenerator( |
394 | 403 | DeclarativePartitionFactory( |
395 | 404 | stream_name=declarative_stream.name, |
396 | | - json_schema=declarative_stream.get_json_schema(), |
| 405 | + schema_loader=declarative_stream._schema_loader, # type: ignore # We are accessing the private property but the public one is optional and we will remove this code soonish |
397 | 406 | retriever=declarative_stream.retriever, |
398 | 407 | message_repository=self.message_repository, |
399 | 408 | max_records_limit=self._limits.max_records if self._limits else None, |
@@ -457,7 +466,7 @@ def _group_streams( |
457 | 466 | partition_generator = StreamSlicerPartitionGenerator( |
458 | 467 | DeclarativePartitionFactory( |
459 | 468 | stream_name=declarative_stream.name, |
460 | | - json_schema=declarative_stream.get_json_schema(), |
| 469 | + schema_loader=declarative_stream._schema_loader, # type: ignore # We are accessing the private property but the public one is optional and we will remove this code soonish |
461 | 470 | retriever=retriever, |
462 | 471 | message_repository=self.message_repository, |
463 | 472 | max_records_limit=self._limits.max_records if self._limits else None, |
|
0 commit comments