-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Connector builder server: Add inferred schema to read API response #20942
Conversation
…airbyte into flash1293/schema-inferrer-api
Unit tests are not working right currently due to unrelated changes, this is fixed on #21107 |
airbyte-connector-builder-server/connector_builder/impl/default_api.py
Outdated
Show resolved
Hide resolved
@@ -108,12 +111,14 @@ async def read_stream(self, stream_read_request_body: StreamReadRequestBody = Bo | |||
:return: Airbyte record messages produced by the sync grouped by slice and page | |||
""" | |||
adapter = self._create_low_code_adapter(manifest=stream_read_request_body.manifest) | |||
schema_inferrer = SchemaInferrer() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this class is stateful right? we'll need to reset it or create a new SchemaInferrer for every read to avoid leaking the type of records produced from a different configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this a local variable in the scope of the current read_stream
invocation? If that's the case there should be a new schema inferrer for every call of read_stream
which is exactly what we want, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
derp. my bad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -108,12 +111,14 @@ async def read_stream(self, stream_read_request_body: StreamReadRequestBody = Bo | |||
:return: Airbyte record messages produced by the sync grouped by slice and page | |||
""" | |||
adapter = self._create_low_code_adapter(manifest=stream_read_request_body.manifest) | |||
schema_inferrer = SchemaInferrer() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
derp. my bad
…20942) * fix stuff * add inferred schema to API * fix yaml changes * fix yaml formatting * add whitespace back * reorder imports
Fixes #20831
What
Adds the inferred schema for all encountered records to the response of the read API. Will be consumed by the UI in a subsequent PR to allow to add the schema for a stream with a single click
How
Uses the utility class introduced in #20941 to run all records through the inferrer and attach the final response to the response.