Skip to content

Commit 052d5dd

Browse files
authored
Merge branch 'main' into lazebnyi/add-cocurency-to-partial-declarative-sources
2 parents 7bec79b + e1a182c commit 052d5dd

File tree

113 files changed

+6720
-2361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+6720
-2361
lines changed

.github/workflows/connector-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
# cdk_extra: n/a
8989
# TODO: These are manifest connectors and won't work as expected until we
9090
# add `--use-local-cdk` support for manifest connectors.
91-
- connector: source-the-guardian-api
91+
- connector: source-amplitude
9292
cdk_extra: n/a
9393
- connector: source-pokeapi
9494
cdk_extra: n/a
@@ -128,7 +128,7 @@ jobs:
128128
- name: Set up Python
129129
uses: actions/setup-python@v5
130130
with:
131-
python-version: "3.10"
131+
python-version: "3.11"
132132
# Create initial pending status for test report
133133
- name: Create Pending Test Report Status
134134
if: steps.no_changes.outputs.status != 'cancelled'

.github/workflows/pypi_publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ jobs:
146146
(github.event_name == 'push' &&
147147
startsWith(github.ref, 'refs/tags/v')
148148
) || github.event.inputs.publish_to_pypi == 'true'
149-
uses: pypa/[email protected].3
149+
uses: pypa/[email protected].4
150150

151151
publish_sdm:
152152
name: Publish SDM to DockerHub

airbyte_cdk/connector_builder/connector_builder_handler.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
33
#
44

5-
import dataclasses
5+
6+
from dataclasses import asdict, dataclass, field
67
from typing import Any, List, Mapping
78

8-
from airbyte_cdk.connector_builder.message_grouper import MessageGrouper
9+
from airbyte_cdk.connector_builder.test_reader import TestReader
910
from airbyte_cdk.models import (
1011
AirbyteMessage,
1112
AirbyteRecordMessage,
@@ -32,11 +33,11 @@
3233
MAX_RECORDS_KEY = "max_records"
3334

3435

35-
@dataclasses.dataclass
36+
@dataclass
3637
class TestReadLimits:
37-
max_records: int = dataclasses.field(default=DEFAULT_MAXIMUM_RECORDS)
38-
max_pages_per_slice: int = dataclasses.field(default=DEFAULT_MAXIMUM_NUMBER_OF_PAGES_PER_SLICE)
39-
max_slices: int = dataclasses.field(default=DEFAULT_MAXIMUM_NUMBER_OF_SLICES)
38+
max_records: int = field(default=DEFAULT_MAXIMUM_RECORDS)
39+
max_pages_per_slice: int = field(default=DEFAULT_MAXIMUM_NUMBER_OF_PAGES_PER_SLICE)
40+
max_slices: int = field(default=DEFAULT_MAXIMUM_NUMBER_OF_SLICES)
4041

4142

4243
def get_limits(config: Mapping[str, Any]) -> TestReadLimits:
@@ -73,17 +74,20 @@ def read_stream(
7374
limits: TestReadLimits,
7475
) -> AirbyteMessage:
7576
try:
76-
handler = MessageGrouper(limits.max_pages_per_slice, limits.max_slices, limits.max_records)
77-
stream_name = configured_catalog.streams[
78-
0
79-
].stream.name # The connector builder only supports a single stream
80-
stream_read = handler.get_message_groups(
77+
test_read_handler = TestReader(
78+
limits.max_pages_per_slice, limits.max_slices, limits.max_records
79+
)
80+
# The connector builder only supports a single stream
81+
stream_name = configured_catalog.streams[0].stream.name
82+
83+
stream_read = test_read_handler.run_test_read(
8184
source, config, configured_catalog, state, limits.max_records
8285
)
86+
8387
return AirbyteMessage(
8488
type=MessageType.RECORD,
8589
record=AirbyteRecordMessage(
86-
data=dataclasses.asdict(stream_read), stream=stream_name, emitted_at=_emitted_at()
90+
data=asdict(stream_read), stream=stream_name, emitted_at=_emitted_at()
8791
),
8892
)
8993
except Exception as exc:

0 commit comments

Comments
 (0)