Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use flexidate #112

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
'singer-python==5.3.1',
'psycopg2==2.7.4',
'strict-rfc3339==0.7',
'flexidate==1.4',
],
extras_require={
'dev': [
Expand Down
6 changes: 3 additions & 3 deletions tap_postgres/sync_strategies/logical_replication.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import singer.metadata as metadata
import tap_postgres.db as post_db
import tap_postgres.sync_strategies.common as sync_common
from dateutil.parser import parse
from flexidate import parse
import psycopg2
from psycopg2 import sql
import copy
Expand Down Expand Up @@ -157,8 +157,8 @@ def selected_value_to_singer_value_impl(elem, og_sql_datatype, conn_info):
if sql_datatype == 'date':
if isinstance(elem, datetime.date):
#logical replication gives us dates as strings UNLESS they from an array
return elem.isoformat() + 'T00:00:00+00:00'
return parse(elem).isoformat() + "+00:00"
return elem.isoformat()
return parse(elem).isoformat()
if sql_datatype == 'time with time zone':
return parse(elem).isoformat().split('T')[1]
if sql_datatype == 'bit':
Expand Down