From 64f61f65200fcbb03f571311981115e41c53935e Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 17 Apr 2023 18:33:04 -0600 Subject: [PATCH] Don't rebuild stream_maps[stream_name] if stream is already known --- singer_sdk/mapper.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/singer_sdk/mapper.py b/singer_sdk/mapper.py index 031ca0c82..f9bf3017b 100644 --- a/singer_sdk/mapper.py +++ b/singer_sdk/mapper.py @@ -664,11 +664,14 @@ def register_raw_stream_schema( # noqa: PLR0912, C901 if stream_name in self.stream_maps: primary_mapper = self.stream_maps[stream_name][0] if ( - primary_mapper.raw_schema != schema - or primary_mapper.raw_key_properties != key_properties + isinstance(primary_mapper, self.default_mapper_type) + and primary_mapper.raw_schema == schema + and primary_mapper.raw_key_properties == key_properties ): - # Unload/reset stream maps if schema or key properties have changed. - self.stream_maps.pop(stream_name) + return + + # Unload/reset stream maps if schema or key properties have changed. + self.stream_maps.pop(stream_name) if stream_name not in self.stream_maps: # The 0th mapper should be the same-named treatment.