aboutsummaryrefslogtreecommitdiffhomepage
path: root/tap_google_sheets
diff options
context:
space:
mode:
Diffstat (limited to 'tap_google_sheets')
-rw-r--r--tap_google_sheets/sync.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tap_google_sheets/sync.py b/tap_google_sheets/sync.py
index 26c2d19..986c6ca 100644
--- a/tap_google_sheets/sync.py
+++ b/tap_google_sheets/sync.py
@@ -64,6 +64,15 @@ def write_bookmark(state, stream, value):
64 singer.write_state(state) 64 singer.write_state(state)
65 65
66 66
67def drop_date_on_time(schema, record):
68 for field, field_schema in schema['properties'].items():
69 if field_schema.get('format') == 'time':
70 # `time` fields come back from Google like `X days, H:M:S`
71 old_time = record[field]
72 new_time = old_time.split(',')[1].strip()
73 record[field] = new_time
74 return record
75
67# Transform/validate batch of records w/ schema and sent to target 76# Transform/validate batch of records w/ schema and sent to target
68def process_records(catalog, 77def process_records(catalog,
69 stream_name, 78 stream_name,
@@ -78,8 +87,9 @@ def process_records(catalog,
78 # Transform record for Singer.io 87 # Transform record for Singer.io
79 with Transformer() as transformer: 88 with Transformer() as transformer:
80 try: 89 try:
90 edited_record = drop_date_on_time(schema, record)
81 transformed_record = transformer.transform( 91 transformed_record = transformer.transform(
82 record, 92 edited_record,
83 schema, 93 schema,
84 stream_metadata) 94 stream_metadata)
85 except Exception as err: 95 except Exception as err: