Skip to content

Commit

Permalink
Use RFC3339 for date formats when emitting records and state (#30)
Browse files Browse the repository at this point in the history
* Use RFC3339 for date formats when emitting records and state

* bump up package version

* fix failing ci test

* omit tox folder

* clean up coverage data after test

* Revert tox file content

* Clean up tox file

* Update coverage version

* Set coverage version to use in tox deps

* Use new cache on build

* Revert cache build

* Strictly use stable version of coverage
  • Loading branch information
Gbolahan Okerayi authored and rflprr committed Sep 14, 2018
1 parent 228ffd8 commit 0d6ae4f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
test=pytest

[flake8]
exclude=build, .eggs
exclude=build, .eggs, .tox/*

[coverage:run]
source=.
data_file=.coverage
omit=build, .eggs/*
omit=build, .eggs/*, .tox/*

[coverage:report]
omit=build, .eggs/*
omit=build, .eggs/*, .tox/*
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def find_version(*paths):
py_modules=['tap-redshift'],
packages=find_packages(),
install_requires=[
'attrs==17.2.0',
'attrs==18.2.0',
'pendulum==1.2.0',
'singer-python==5.0.4',
'backoff==1.3.2',
Expand All @@ -59,7 +59,7 @@ def find_version(*paths):
tests_require=[
'pytest-mock>=1.6.3',
'mock>=2.0.0',
'coverage>=4.4.2',
'coverage==4.5.1',
'doublex>=1.8.4,<2.0a',
'flake8>=2.6.0,<3.4.1a',
'pyhamcrest>=1.9.0,<2.0a',
Expand Down
10 changes: 6 additions & 4 deletions tap_redshift/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

from tap_redshift import resolve

__version__ = '1.0.0b8'
__version__ = '1.0.0b9'

LOGGER = singer.get_logger()

Expand Down Expand Up @@ -277,6 +277,8 @@ def get_stream_version(tap_stream_id, state):
def row_to_record(catalog_entry, version, row, columns, time_extracted):
row_to_persist = ()
for idx, elem in enumerate(row):
if isinstance(elem, datetime.date):
elem = elem.isoformat('T') + 'Z'
row_to_persist += (elem,)
return singer.RecordMessage(
stream=catalog_entry.stream,
Expand Down Expand Up @@ -307,8 +309,8 @@ def sync_table(connection, catalog_entry, state):
params = {}

if start_date is not None:
formatted_start_date = str(datetime.datetime.strptime(
start_date, '%Y-%m-%dT%H:%M:%SZ'))
formatted_start_date = datetime.datetime.strptime(
start_date, '%Y-%m-%dT%H:%M:%SZ').astimezone()

replication_key = metadata.to_map(catalog_entry.metadata).get(
(), {}).get('replication-key')
Expand Down Expand Up @@ -341,7 +343,7 @@ def sync_table(connection, catalog_entry, state):
state,
tap_stream_id,
'replication_key_value'
) or formatted_start_date
) or formatted_start_date.isoformat()

if replication_key_value is not None:
entry_schema = catalog_entry.schema
Expand Down
7 changes: 3 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
envlist=py36
[testenv]
deps=
coverage
coverage<=4.5.1
flake8
commands=
flake8 . \
--exclude=./.tox/*,./.eggs/*,./build/*
flake8 .
coverage run setup.py test {posargs}
coverage report --omit=./.tox/* --fail-under=70
coverage report --fail-under=70

0 comments on commit 0d6ae4f

Please sign in to comment.