Skip to content

Commit 9664679

Browse files
committed
Fix child extraction
1 parent ad75c52 commit 9664679

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2754,6 +2754,14 @@ def create_simple_retriever(
27542754
"LazySimpleRetriever only supports 'SubstreamPartitionRouterModel' as the 'partition_router' type. " # type: ignore[union-attr] # model.partition_router has BaseModel type
27552755
f"Found: '{model.partition_router.type}'."
27562756
)
2757+
lazy_read_pointer = []
2758+
for i, path in enumerate(model.lazy_read_pointer):
2759+
if path == "*":
2760+
raise ValueError(
2761+
f"'lazy_read_pointer' support only direct pointing. Found: '* as a {i} element in the pointer.'"
2762+
)
2763+
2764+
lazy_read_pointer.append(InterpolatedString.create(path, parameters=model.parameters or {}))
27572765

27582766
lazy_read_pointer = [
27592767
InterpolatedString.create(path, parameters=model.parameters or {})

airbyte_cdk/sources/declarative/retrievers/simple_retriever.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -714,11 +714,7 @@ def _extract_child_records(
714714
return parent_record
715715

716716
path = [path.eval(self.config) for path in self.lazy_read_pointer]
717-
return (
718-
dpath.values(parent_record, path) # type: ignore # return value will be a MutableMapping, given input data structure
719-
if "*" in path
720-
else dpath.get(parent_record, path, default=[])
721-
)
717+
return dpath.get(parent_record, path, default=[])
722718

723719
def _create_response(self, data: Mapping[str, Any]) -> SafeResponse:
724720
"""Create a SafeResponse with the given data."""

0 commit comments

Comments
 (0)