Skip to content
This repository was archived by the owner on Sep 23, 2024. It is now read-only.

Commit dbe17a2

Browse files
committed
Add support for transferring postgres range types as json objects
1 parent 14a0be5 commit dbe17a2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

tap_postgres/db.py

+2
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ def selected_value_to_singer_value_impl(elem, sql_datatype):
159159
cleaned_elem = elem
160160
else:
161161
raise Exception(f"do not know how to marshall a dict if its not an hstore or json: {sql_datatype}")
162+
elif 'range' in sql_datatype:
163+
cleaned_elem = {'lower': elem.lower, 'upper': elem.upper, 'bounds': elem._bounds}
162164
else:
163165
raise Exception(
164166
f"do not know how to marshall value of class( {elem.__class__} ) and sql_datatype ( {sql_datatype} )")

tap_postgres/discovery_utils.py

+4
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ def schema_for_column_datatype(col):
280280
schema['type'] = nullable_column('string', col.is_primary_key)
281281
return schema
282282

283+
if 'range' in data_type:
284+
schema['type'] = nullable_column('object', col.is_primary_key)
285+
return schema
286+
283287
return schema
284288

285289

0 commit comments

Comments
 (0)