23
23
ConfiguredAirbyteCatalog ,
24
24
TraceType ,
25
25
)
26
- from airbyte_cdk .sources .declarative .declarative_source import DeclarativeSource
26
+ from airbyte_cdk .sources .declarative .concurrent_declarative_source import (
27
+ ConcurrentDeclarativeSource ,
28
+ )
27
29
from airbyte_cdk .utils import AirbyteTracedException
28
30
from airbyte_cdk .utils .datetime_format_inferrer import DatetimeFormatInferrer
29
31
from airbyte_cdk .utils .schema_inferrer import (
@@ -55,7 +57,7 @@ class TestReader:
55
57
that contains slices of data, log messages, auxiliary requests, and any inferred schema or datetime formats.
56
58
57
59
Parameters:
58
- source (DeclarativeSource ): The data source to read from.
60
+ source (ConcurrentDeclarativeSource ): The data source to read from.
59
61
config (Mapping[str, Any]): Configuration parameters for the source.
60
62
configured_catalog (ConfiguredAirbyteCatalog): Catalog containing stream configuration.
61
63
state (List[AirbyteStateMessage]): Current state information for the read.
@@ -83,7 +85,7 @@ def __init__(
83
85
84
86
def run_test_read (
85
87
self ,
86
- source : DeclarativeSource ,
88
+ source : ConcurrentDeclarativeSource [ Optional [ List [ AirbyteStateMessage ]]] ,
87
89
config : Mapping [str , Any ],
88
90
configured_catalog : ConfiguredAirbyteCatalog ,
89
91
stream_name : str ,
@@ -94,7 +96,7 @@ def run_test_read(
94
96
Run a test read for the connector by reading from a single stream and inferring schema and datetime formats.
95
97
96
98
Parameters:
97
- source (DeclarativeSource ): The source instance providing the streams.
99
+ source (ConcurrentDeclarativeSource ): The source instance providing the streams.
98
100
config (Mapping[str, Any]): The configuration settings to use for reading.
99
101
configured_catalog (ConfiguredAirbyteCatalog): The catalog specifying the stream configuration.
100
102
state (List[AirbyteStateMessage]): A list of state messages to resume the read.
@@ -126,7 +128,7 @@ def run_test_read(
126
128
if stream
127
129
else None ,
128
130
self ._cursor_field_to_nested_and_composite_field (stream .cursor_field )
129
- if stream
131
+ if stream and stream . cursor_field
130
132
else None ,
131
133
)
132
134
datetime_format_inferrer = DatetimeFormatInferrer ()
@@ -381,13 +383,13 @@ def _get_latest_config_update(
381
383
382
384
def _read_stream (
383
385
self ,
384
- source : DeclarativeSource ,
386
+ source : ConcurrentDeclarativeSource [ Optional [ List [ AirbyteStateMessage ]]] ,
385
387
config : Mapping [str , Any ],
386
388
configured_catalog : ConfiguredAirbyteCatalog ,
387
389
state : List [AirbyteStateMessage ],
388
390
) -> Iterator [AirbyteMessage ]:
389
391
"""
390
- Reads messages from the given DeclarativeSource using an AirbyteEntrypoint.
392
+ Reads messages from the given ConcurrentDeclarativeSource using an AirbyteEntrypoint.
391
393
392
394
This method attempts to yield messages from the source's read generator. If the generator
393
395
raises an AirbyteTracedException, it checks whether the exception message indicates a non-actionable
@@ -396,7 +398,7 @@ def _read_stream(
396
398
wrapped into an AirbyteTracedException, and yielded as an AirbyteMessage.
397
399
398
400
Parameters:
399
- source (DeclarativeSource ): The source object that provides data reading logic.
401
+ source (ConcurrentDeclarativeSource ): The source object that provides data reading logic.
400
402
config (Mapping[str, Any]): The configuration dictionary for the source.
401
403
configured_catalog (ConfiguredAirbyteCatalog): The catalog defining the streams and their configurations.
402
404
state (List[AirbyteStateMessage]): A list representing the current state for incremental sync.
0 commit comments