From 34cd3402471b50477d86b6c06a7c9230f235dc30 Mon Sep 17 00:00:00 2001 From: Mathew Fournier Date: Mon, 5 Jun 2023 09:49:35 -0700 Subject: [PATCH] matf/stop-overwriting-state-on-empty-state - 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()