airbyte-cdk 6.42.2__py3-none-any.whl → 6.43.0__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/connector_builder/connector_builder_handler.py +22 -8
- airbyte_cdk/connector_builder/main.py +3 -3
- {airbyte_cdk-6.42.2.dist-info → airbyte_cdk-6.43.0.dist-info}/METADATA +1 -1
- {airbyte_cdk-6.42.2.dist-info → airbyte_cdk-6.43.0.dist-info}/RECORD +8 -8
- {airbyte_cdk-6.42.2.dist-info → airbyte_cdk-6.43.0.dist-info}/LICENSE.txt +0 -0
- {airbyte_cdk-6.42.2.dist-info → airbyte_cdk-6.43.0.dist-info}/LICENSE_SHORT +0 -0
- {airbyte_cdk-6.42.2.dist-info → airbyte_cdk-6.43.0.dist-info}/WHEEL +0 -0
- {airbyte_cdk-6.42.2.dist-info → airbyte_cdk-6.43.0.dist-info}/entry_points.txt +0 -0
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
from dataclasses import asdict, dataclass, field
|
7
|
-
from typing import Any, List, Mapping
|
7
|
+
from typing import Any, Dict, List, Mapping
|
8
8
|
|
9
9
|
from airbyte_cdk.connector_builder.test_reader import TestReader
|
10
10
|
from airbyte_cdk.models import (
|
@@ -27,30 +27,34 @@ from airbyte_cdk.utils.traced_exception import AirbyteTracedException
|
|
27
27
|
DEFAULT_MAXIMUM_NUMBER_OF_PAGES_PER_SLICE = 5
|
28
28
|
DEFAULT_MAXIMUM_NUMBER_OF_SLICES = 5
|
29
29
|
DEFAULT_MAXIMUM_RECORDS = 100
|
30
|
+
DEFAULT_MAXIMUM_STREAMS = 100
|
30
31
|
|
31
32
|
MAX_PAGES_PER_SLICE_KEY = "max_pages_per_slice"
|
32
33
|
MAX_SLICES_KEY = "max_slices"
|
33
34
|
MAX_RECORDS_KEY = "max_records"
|
35
|
+
MAX_STREAMS_KEY = "max_streams"
|
34
36
|
|
35
37
|
|
36
38
|
@dataclass
|
37
|
-
class
|
39
|
+
class TestLimits:
|
38
40
|
max_records: int = field(default=DEFAULT_MAXIMUM_RECORDS)
|
39
41
|
max_pages_per_slice: int = field(default=DEFAULT_MAXIMUM_NUMBER_OF_PAGES_PER_SLICE)
|
40
42
|
max_slices: int = field(default=DEFAULT_MAXIMUM_NUMBER_OF_SLICES)
|
43
|
+
max_streams: int = field(default=DEFAULT_MAXIMUM_STREAMS)
|
41
44
|
|
42
45
|
|
43
|
-
def get_limits(config: Mapping[str, Any]) ->
|
46
|
+
def get_limits(config: Mapping[str, Any]) -> TestLimits:
|
44
47
|
command_config = config.get("__test_read_config", {})
|
45
48
|
max_pages_per_slice = (
|
46
49
|
command_config.get(MAX_PAGES_PER_SLICE_KEY) or DEFAULT_MAXIMUM_NUMBER_OF_PAGES_PER_SLICE
|
47
50
|
)
|
48
51
|
max_slices = command_config.get(MAX_SLICES_KEY) or DEFAULT_MAXIMUM_NUMBER_OF_SLICES
|
49
52
|
max_records = command_config.get(MAX_RECORDS_KEY) or DEFAULT_MAXIMUM_RECORDS
|
50
|
-
|
53
|
+
max_streams = command_config.get(MAX_STREAMS_KEY) or DEFAULT_MAXIMUM_STREAMS
|
54
|
+
return TestLimits(max_records, max_pages_per_slice, max_slices, max_streams)
|
51
55
|
|
52
56
|
|
53
|
-
def create_source(config: Mapping[str, Any], limits:
|
57
|
+
def create_source(config: Mapping[str, Any], limits: TestLimits) -> ManifestDeclarativeSource:
|
54
58
|
manifest = config["__injected_declarative_manifest"]
|
55
59
|
return ManifestDeclarativeSource(
|
56
60
|
config=config,
|
@@ -71,7 +75,7 @@ def read_stream(
|
|
71
75
|
config: Mapping[str, Any],
|
72
76
|
configured_catalog: ConfiguredAirbyteCatalog,
|
73
77
|
state: List[AirbyteStateMessage],
|
74
|
-
limits:
|
78
|
+
limits: TestLimits,
|
75
79
|
) -> AirbyteMessage:
|
76
80
|
try:
|
77
81
|
test_read_handler = TestReader(
|
@@ -117,13 +121,23 @@ def resolve_manifest(source: ManifestDeclarativeSource) -> AirbyteMessage:
|
|
117
121
|
return error.as_airbyte_message()
|
118
122
|
|
119
123
|
|
120
|
-
def full_resolve_manifest(source: ManifestDeclarativeSource) -> AirbyteMessage:
|
124
|
+
def full_resolve_manifest(source: ManifestDeclarativeSource, limits: TestLimits) -> AirbyteMessage:
|
121
125
|
try:
|
122
126
|
manifest = {**source.resolved_manifest}
|
123
127
|
streams = manifest.get("streams", [])
|
124
128
|
for stream in streams:
|
125
129
|
stream["dynamic_stream_name"] = None
|
126
|
-
|
130
|
+
|
131
|
+
mapped_streams: Dict[str, List[Dict[str, Any]]] = {}
|
132
|
+
for stream in source.dynamic_streams:
|
133
|
+
generated_streams = mapped_streams.setdefault(stream["dynamic_stream_name"], [])
|
134
|
+
|
135
|
+
if len(generated_streams) < limits.max_streams:
|
136
|
+
generated_streams += [stream]
|
137
|
+
|
138
|
+
for generated_streams_list in mapped_streams.values():
|
139
|
+
streams.extend(generated_streams_list)
|
140
|
+
|
127
141
|
manifest["streams"] = streams
|
128
142
|
return AirbyteMessage(
|
129
143
|
type=Type.RECORD,
|
@@ -10,7 +10,7 @@ import orjson
|
|
10
10
|
|
11
11
|
from airbyte_cdk.connector import BaseConnector
|
12
12
|
from airbyte_cdk.connector_builder.connector_builder_handler import (
|
13
|
-
|
13
|
+
TestLimits,
|
14
14
|
create_source,
|
15
15
|
full_resolve_manifest,
|
16
16
|
get_limits,
|
@@ -73,7 +73,7 @@ def handle_connector_builder_request(
|
|
73
73
|
config: Mapping[str, Any],
|
74
74
|
catalog: Optional[ConfiguredAirbyteCatalog],
|
75
75
|
state: List[AirbyteStateMessage],
|
76
|
-
limits:
|
76
|
+
limits: TestLimits,
|
77
77
|
) -> AirbyteMessage:
|
78
78
|
if command == "resolve_manifest":
|
79
79
|
return resolve_manifest(source)
|
@@ -83,7 +83,7 @@ def handle_connector_builder_request(
|
|
83
83
|
), "`test_read` requires a valid `ConfiguredAirbyteCatalog`, got None."
|
84
84
|
return read_stream(source, config, catalog, state, limits)
|
85
85
|
elif command == "full_resolve_manifest":
|
86
|
-
return full_resolve_manifest(source)
|
86
|
+
return full_resolve_manifest(source, limits)
|
87
87
|
else:
|
88
88
|
raise ValueError(f"Unrecognized command {command}.")
|
89
89
|
|
@@ -7,8 +7,8 @@ airbyte_cdk/config_observation.py,sha256=7SSPxtN0nXPkm4euGNcTTr1iLbwUL01jy-24V1H
|
|
7
7
|
airbyte_cdk/connector.py,sha256=bO23kdGRkl8XKFytOgrrWFc_VagteTHVEF6IsbizVkM,4224
|
8
8
|
airbyte_cdk/connector_builder/README.md,sha256=Hw3wvVewuHG9-QgsAq1jDiKuLlStDxKBz52ftyNRnBw,1665
|
9
9
|
airbyte_cdk/connector_builder/__init__.py,sha256=4Hw-PX1-VgESLF16cDdvuYCzGJtHntThLF4qIiULWeo,61
|
10
|
-
airbyte_cdk/connector_builder/connector_builder_handler.py,sha256=
|
11
|
-
airbyte_cdk/connector_builder/main.py,sha256=
|
10
|
+
airbyte_cdk/connector_builder/connector_builder_handler.py,sha256=gwFpZHmvFrMB9NMlRuRfq0KEkbPaFucCB8k1DL20Wmw,5769
|
11
|
+
airbyte_cdk/connector_builder/main.py,sha256=7hE4GG8yTLSas_nUuANsPJQVBZyOK-l_1Q0vf0FjY5o,3839
|
12
12
|
airbyte_cdk/connector_builder/models.py,sha256=9pIZ98LW_d6fRS39VdnUOf3cxGt4TkC5MJ0_OrzcCRk,1578
|
13
13
|
airbyte_cdk/connector_builder/test_reader/__init__.py,sha256=iTwBMoI9vaJotEgpqZbFjlxRcbxXYypSVJ9YxeHk7wc,120
|
14
14
|
airbyte_cdk/connector_builder/test_reader/helpers.py,sha256=Iczn-_iczS2CaIAunWwyFcX0uLTra8Wh9JVfzm1Gfxo,26765
|
@@ -359,9 +359,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
|
|
359
359
|
airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
|
360
360
|
airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
|
361
361
|
airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
|
362
|
-
airbyte_cdk-6.
|
363
|
-
airbyte_cdk-6.
|
364
|
-
airbyte_cdk-6.
|
365
|
-
airbyte_cdk-6.
|
366
|
-
airbyte_cdk-6.
|
367
|
-
airbyte_cdk-6.
|
362
|
+
airbyte_cdk-6.43.0.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
|
363
|
+
airbyte_cdk-6.43.0.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
|
364
|
+
airbyte_cdk-6.43.0.dist-info/METADATA,sha256=WjvyAp97UTLMevABw3FGEGikJicZsgjbDWHgyeP1QBY,6071
|
365
|
+
airbyte_cdk-6.43.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
366
|
+
airbyte_cdk-6.43.0.dist-info/entry_points.txt,sha256=fj-e3PAQvsxsQzyyq8UkG1k8spunWnD4BAH2AwlR6NM,95
|
367
|
+
airbyte_cdk-6.43.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|