Skip to content

Commit 34f8796

Browse files
committed
ignore streams without schemas when normalizing them
1 parent 795a896 commit 34f8796

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

airbyte_cdk/sources/declarative/parsers/manifest_normalizer.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,14 @@ def _extract_stream_schema(self, stream: Dict[str, Any]) -> None:
169169
"""
170170

171171
stream_name = stream["name"]
172+
172173
# copy the value of the SCHEMA_TAG to the SCHEMAS_TAG with the stream name as key
173174
schema = stream.get(SCHEMA_LOADER_TAG, {}).get(SCHEMA_TAG)
175+
176+
# if the schema is not found, do nothing
177+
if not schema:
178+
return
179+
174180
if not SCHEMAS_TAG in self._normalized_manifest.keys():
175181
self._normalized_manifest[SCHEMAS_TAG] = {}
176182
# add stream schema to the SCHEMAS_TAG
@@ -198,7 +204,9 @@ def _set_stream_schema_ref(self, stream: Dict[str, Any]) -> None:
198204
stream_name = stream["name"]
199205
if SCHEMAS_TAG in self._normalized_manifest.keys():
200206
if stream_name in self._normalized_manifest[SCHEMAS_TAG]:
201-
stream[SCHEMA_LOADER_TAG][SCHEMA_TAG] = self._create_schema_ref(stream_name)
207+
if SCHEMA_LOADER_TAG in stream.keys():
208+
if SCHEMA_TAG in stream[SCHEMA_LOADER_TAG].keys():
209+
stream[SCHEMA_LOADER_TAG][SCHEMA_TAG] = self._create_schema_ref(stream_name)
202210

203211
def _replace_duplicates_with_refs(self, duplicates: DuplicatesType) -> None:
204212
"""

0 commit comments

Comments
 (0)