From 010678683311f01e23273a00cf49d637722924c2 Mon Sep 17 00:00:00 2001 From: Benjamin Theunissen Date: Tue, 21 Nov 2023 17:22:36 -0500 Subject: [PATCH] Set to NULL on error of datetime parse --- pyproject.toml | 2 +- target_clickhouse/sinks.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0ba6d98..16864d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "shaped-target-clickhouse" -version = "0.1.10" +version = "0.1.11" 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 5b73b1d..a9210d9 100644 --- a/target_clickhouse/sinks.py +++ b/target_clickhouse/sinks.py @@ -10,6 +10,9 @@ import simplejson as json import sqlalchemy from pendulum import now +from singer_sdk.helpers._typing import ( + DatetimeErrorTreatmentEnum, +) from singer_sdk.sinks import SQLSink from sqlalchemy.sql.expression import bindparam @@ -52,6 +55,11 @@ def full_table_name(self) -> str: db_name=self.database_name, ) + @property + def datetime_error_treatment(self) -> DatetimeErrorTreatmentEnum: + """Return a treatment to use for datetime parse errors: ERROR. MAX, or NULL.""" + return DatetimeErrorTreatmentEnum.NULL + def bulk_insert_records( self, full_table_name: str,