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

Commit

Permalink
Add support for transferring postgres range types as strings
Browse files Browse the repository at this point in the history
  • Loading branch information
gwax committed Jun 8, 2022
1 parent 14a0be5 commit 0f91d30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tap_postgres/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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} )")
Expand Down
4 changes: 4 additions & 0 deletions tap_postgres/discovery_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 0f91d30

Please sign in to comment.