Skip to content

Commit cb99b1e

Browse files
committed
add testing for factory, simple retriever, request options provider and fix bug emitting as Record instead of mapping
1 parent cad709e commit cb99b1e

File tree

5 files changed

+953
-26
lines changed

5 files changed

+953
-26
lines changed

airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,7 +2856,7 @@ def create_simple_retriever(
28562856

28572857
if len(query_properties_definitions) > 1:
28582858
raise ValueError(
2859-
f"request_parameters should only define one QueryProperties field, but found {len(query_properties_definitions)}"
2859+
f"request_parameters only supports defining one QueryProperties field, but found {len(query_properties_definitions)} usages"
28602860
)
28612861

28622862
if len(query_properties_definitions) == 1:
@@ -3000,27 +3000,6 @@ def _remove_query_properties(
30003000
or not request_parameter.get("type") == "QueryProperties"
30013001
}
30023002

3003-
@staticmethod
3004-
def _translate_query_properties_to_interpolated_strings(
3005-
request_parameters: Mapping[str, Union[Any, str]],
3006-
) -> Mapping[str, Union[Any, str]]:
3007-
# todo blai: remove this since unused
3008-
new_request_parameters = dict()
3009-
for key, request_parameter in request_parameters.items():
3010-
if (
3011-
isinstance(request_parameter, Mapping)
3012-
and request_parameter.get("type") == "QueryProperties"
3013-
):
3014-
# This may seem like this could be combined into the above conditional, but this is separated
3015-
# so that we do not add the properties into the new request_parameters mapping
3016-
if request_parameter.get("inject_into"):
3017-
new_request_parameters[key] = (
3018-
"{{ stream_partition.extra_fields['query_properties'] }}"
3019-
)
3020-
else:
3021-
new_request_parameters[key] = request_parameter
3022-
return new_request_parameters
3023-
30243003
def create_state_delegating_stream(
30253004
self,
30263005
model: StateDelegatingStreamModel,

airbyte_cdk/sources/declarative/retrievers/simple_retriever.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,10 @@ def read_records(
515515
self.cursor.close_slice(_slice, most_recent_record_from_slice)
516516

517517
if has_multiple_chunks:
518-
yield from merged_records.values()
518+
yield from [
519+
Record(data=merged_record, stream_name=self.name, associated_slice=stream_slice)
520+
for merged_record in merged_records.values()
521+
]
519522
else:
520523
_slice = stream_slice or StreamSlice(partition={}, cursor_slice={}) # None-check
521524

0 commit comments

Comments
 (0)