From 831623e00fde518343a30001779adf8214bd00b4 Mon Sep 17 00:00:00 2001 From: Mathew Fournier <72214209+shopmatfournier@users.noreply.github.com> Date: Thu, 8 Jun 2023 11:17:15 -0700 Subject: [PATCH] matf/stop-overwriting-state-on-empty-state (#53) - if the state message is empty (that is, no state message was processed) then do not attempt to write the state as this can overwrite state in the event a tap produces no records (or no state message) --- target_bigquery/target.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target_bigquery/target.py b/target_bigquery/target.py index 58880a9..aafce5f 100644 --- a/target_bigquery/target.py +++ b/target_bigquery/target.py @@ -526,5 +526,6 @@ def drain_all(self, is_endofpipe: bool = False) -> None: # type: ignore else: for sink in self._sinks_active.values(): sink.pre_state_hook() - self._write_state_message(state) + if state: + self._write_state_message(state) self._reset_max_record_age()