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

Connector builder server: Add inferred schema to read API response #20942

Merged
merged 16 commits into from
Jan 9, 2023

Conversation

flash1293
Copy link
Contributor

@flash1293 flash1293 commented Jan 2, 2023

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.

@flash1293 flash1293 temporarily deployed to more-secrets January 2, 2023 12:31 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 2, 2023 12:31 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 2, 2023 12:52 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 2, 2023 12:53 — with GitHub Actions Inactive
@flash1293 flash1293 linked an issue Jan 2, 2023 that may be closed by this pull request
Base automatically changed from flash1293/schema-inferrer to master January 6, 2023 12:43
@octavia-squidington-iv octavia-squidington-iv added CDK Connector Development Kit and removed CDK Connector Development Kit labels Jan 6, 2023
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 12:51 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 12:51 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 13:59 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 13:59 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 15:19 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 15:20 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 17:52 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 17:52 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 18:36 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 18:36 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 19:18 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 19:18 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 19:50 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 6, 2023 19:50 — with GitHub Actions Inactive
@flash1293 flash1293 marked this pull request as ready for review January 6, 2023 20:28
@flash1293 flash1293 requested review from girarda and brianjlai January 9, 2023 09:53
@flash1293 flash1293 temporarily deployed to more-secrets January 9, 2023 10:50 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 9, 2023 10:51 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 9, 2023 11:35 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 9, 2023 11:35 — with GitHub Actions Inactive
@flash1293
Copy link
Contributor Author

Unit tests are not working right currently due to unrelated changes, this is fixed on #21107

@@ -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()
Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

derp. my bad

@flash1293 flash1293 temporarily deployed to more-secrets January 9, 2023 16:34 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 9, 2023 16:34 — with GitHub Actions Inactive
Copy link
Contributor

@girarda girarda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@@ -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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

derp. my bad

@flash1293 flash1293 enabled auto-merge (squash) January 9, 2023 17:32
@flash1293 flash1293 temporarily deployed to more-secrets January 9, 2023 17:33 — with GitHub Actions Inactive
@flash1293 flash1293 temporarily deployed to more-secrets January 9, 2023 17:34 — with GitHub Actions Inactive
@flash1293 flash1293 merged commit 45006a7 into master Jan 9, 2023
@flash1293 flash1293 deleted the flash1293/schema-inferrer-api branch January 9, 2023 18:08
jbfbell pushed a commit that referenced this pull request Jan 13, 2023
…20942)

* fix stuff

* add inferred schema to API

* fix yaml changes

* fix yaml formatting

* add whitespace back

* reorder imports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Connector Builder Server] Expose inferred schema in API
3 participants