singer-io / singer-python

Writes the Singer format from Python
https://singer.io
Apache License 2.0
542 stars 130 forks source link

Add version to write_record method #107

Closed pcorbel closed 4 years ago

pcorbel commented 5 years ago

The write_record method lacks the support of a version.

Some tests give:

import singer

singer.write_record(stream_name="a", record={"hello": "world"})
{"type": "RECORD", "stream": "a", "record": {"hello": "world"}}

singer.write_record(stream_name="a", record={"hello": "world"}, version=None)
{"type": "RECORD", "stream": "a", "record": {"hello": "world"}}

singer.write_record(stream_name="a", record={"hello": "world"}, version="2019-01-01")
{"type": "RECORD", "stream": "a", "record": {"hello": "world"}, "version": "2019-01-01"}

singer.write_record(stream_name="a", record={"hello": "world"}, version=123456789)
{"type": "RECORD", "stream": "a", "record": {"hello": "world"}, "version": 123456789}