Skip to content

Commit

Permalink
fix(targets): Make sink assertion compatible with stream maps (#2589)
Browse files Browse the repository at this point in the history
* Move sink exists assertion to be compatible with stream_maps

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Edgar Ramírez Mondragón <16805946+edgarrmondragon@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 7, 2024
1 parent 21821bd commit 5f2aa19
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion singer_sdk/target_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ def _process_record_message(self, message_dict: dict) -> None:
self._assert_line_requires(message_dict, requires={"stream", "record"})

stream_name = message_dict["stream"]
self._assert_sink_exists(stream_name)
if stream_name not in self.mapper.stream_maps:
self._assert_sink_exists(stream_name)

for stream_map in self.mapper.stream_maps[stream_name]:
raw_record = copy.copy(message_dict["record"])
Expand All @@ -343,6 +344,7 @@ def _process_record_message(self, message_dict: dict) -> None:
# Record was filtered out by the map transform
continue

self._assert_sink_exists(stream_map.stream_alias)
sink = self.get_sink(stream_map.stream_alias, record=transformed_record)
context = sink._get_context(transformed_record) # noqa: SLF001
if sink.include_sdc_metadata_properties:
Expand Down

0 comments on commit 5f2aa19

Please sign in to comment.