From 0f91d3074e5a35d05ba0d66995eeec121f0e85a2 Mon Sep 17 00:00:00 2001 From: George Leslie-Waksman Date: Wed, 8 Jun 2022 00:49:50 -0700 Subject: [PATCH] Add support for transferring postgres range types as strings --- tap_postgres/db.py | 2 ++ tap_postgres/discovery_utils.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/tap_postgres/db.py b/tap_postgres/db.py index f21dd1f0..2693a422 100644 --- a/tap_postgres/db.py +++ b/tap_postgres/db.py @@ -159,6 +159,8 @@ def selected_value_to_singer_value_impl(elem, sql_datatype): cleaned_elem = elem else: raise Exception(f"do not know how to marshall a dict if its not an hstore or json: {sql_datatype}") + elif 'range' in sql_datatype: + cleaned_elem = str(elem) else: raise Exception( f"do not know how to marshall value of class( {elem.__class__} ) and sql_datatype ( {sql_datatype} )") diff --git a/tap_postgres/discovery_utils.py b/tap_postgres/discovery_utils.py index cd9a00c4..f6a214bf 100644 --- a/tap_postgres/discovery_utils.py +++ b/tap_postgres/discovery_utils.py @@ -280,6 +280,10 @@ def schema_for_column_datatype(col): schema['type'] = nullable_column('string', col.is_primary_key) return schema + if 'range' in data_type: + schema['type'] = nullable_column('string', col.is_primary_key) + return schema + return schema