diff --git a/setup.py b/setup.py index b26eaa8..5e28d71 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup setup(name='target-csv', - version='0.3.5', + version='0.3.6', description='Singer.io target for writing CSV files', author='Stitch', url='https://singer.io', diff --git a/target_csv.py b/target_csv.py index 2c60f48..6ec5a80 100755 --- a/target_csv.py +++ b/target_csv.py @@ -39,7 +39,7 @@ def flatten(d, parent_key='', sep='__'): return dict(items) -def persist_messages(delimiter, quotechar, messages, destination_path, fixed_headers): +def persist_messages(delimiter, quotechar, messages, destination_path, fixed_headers, validate): state = None schemas = {} key_properties = {} @@ -59,8 +59,8 @@ def persist_messages(delimiter, quotechar, messages, destination_path, fixed_hea if o['stream'] not in schemas: raise Exception("A record for stream {}" "was encountered before a corresponding schema".format(o['stream'])) - - validators[o['stream']].validate(o['record']) + if validate: + validators[o['stream']].validate(o['record']) filename = o['stream'] + '-' + now + '.csv' filename = os.path.expanduser(os.path.join(destination_path, filename)) @@ -153,7 +153,8 @@ def main(): config.get('quotechar', '"'), input_messages, config.get('destination_path', ''), - config.get('fixed_headers')) + config.get('fixed_headers'), + config.get('validate', True)) emit_state(state) logger.debug("Exiting normally")