From ebacc869f5e28c760b6a2e43ff747e85c05d3e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= <16805946+edgarrmondragon@users.noreply.github.com> Date: Tue, 6 Aug 2024 20:12:06 -0600 Subject: [PATCH] Fix output format of time fields --- tap_mysql/sync_strategies/common.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tap_mysql/sync_strategies/common.py b/tap_mysql/sync_strategies/common.py index 5c2787a..8f64f93 100644 --- a/tap_mysql/sync_strategies/common.py +++ b/tap_mysql/sync_strategies/common.py @@ -103,7 +103,10 @@ def row_to_singer_record(catalog_entry, version, row, columns, time_extracted): elif isinstance(elem, datetime.timedelta): if property_format == 'time': - row_to_persist += (str(elem),) # this should convert time column into 'HH:MM:SS' formatted string + _total_seconds = int(elem.total_seconds()) + _hours, _remainder = divmod(total_seconds, 3600) + _minutes, _seconds = divmod(remainder, 60) + row_to_persist += (f"{hours:02}:{minutes:02}:{seconds:02}",) # this should convert time column into 'HH:MM:SS' formatted string else: epoch = datetime.datetime.utcfromtimestamp(0) timedelta_from_epoch = epoch + elem