From 98637d3fa3c549a7e4af1a16ceec9b421602c9c0 Mon Sep 17 00:00:00 2001 From: Ben Theunissen Date: Tue, 21 Nov 2023 16:41:00 -0500 Subject: [PATCH] Fix lookup type (#77) * Fix * Fix * Fix --- pyproject.toml | 2 +- target_clickhouse/sinks.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2b28861..0ba6d98 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "shaped-target-clickhouse" -version = "0.1.9" +version = "0.1.10" description = "`target-clickhouse` is a Singer target for clickhouse, built with the Meltano Singer SDK." readme = "README.md" authors = ["Ben Theunissen"] diff --git a/target_clickhouse/sinks.py b/target_clickhouse/sinks.py index f3e30dd..5b73b1d 100644 --- a/target_clickhouse/sinks.py +++ b/target_clickhouse/sinks.py @@ -175,6 +175,10 @@ def _pre_validate_for_string_type(self, record: dict) -> dict: for key, value in record.items(): # Checking if the schema expects a string for this key. expected_type = self.schema.get("properties", {}).get(key, {}).get("type") + if expected_type is None: + continue + if not isinstance(expected_type, list): + expected_type = [expected_type] if "string" in expected_type and not isinstance(value, str): # Convert the value to string if it's not already a string. record[key] = (