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

add stream name support in AirbyteRecordMessage #532

Merged
merged 4 commits into from
Oct 9, 2020
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,15 @@ def read(shell_command, is_message=(lambda x: True), transform=(lambda x: x)) ->
if transformed_json.get('type') == "SCHEMA":
pass
elif transformed_json.get('type') == "STATE":
del transformed_json['type']
out_record = AirbyteStateMessage(data=transformed_json)
out_record = AirbyteStateMessage(data=transformed_json["value"])
out_message = AirbyteMessage(type="STATE", state=out_record)
yield transform(out_message)
else:
# todo: remove type from record
# todo: handle stream designation
# todo: check that messages match the discovered schema
del transformed_json['type']
out_record = AirbyteRecordMessage(data=transformed_json, emitted_at=str(datetime.now()))
stream_name = transformed_json["stream"]
out_record = AirbyteRecordMessage(stream=stream_name, data=transformed_json["record"], emitted_at=str(datetime.now()))
out_message = AirbyteMessage(type="RECORD", record=out_record)
yield transform(out_message)
elif out_line:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ public void testSync() throws IOException, InterruptedException, WorkerException
assertTrue(Jsons.deserialize(record.get())
.get("record")
.get("data")
.get("record")
.get("CAD").asDouble() > 0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ definitions:
type: object
additionalProperties: false
required:
- stream
- data
- emitted_at
properties:
stream:
description: "the name of the stream for this record"
type: string
data:
description: "the record data"
type: object
Expand Down