-
Notifications
You must be signed in to change notification settings - Fork 4.6k
[low-code cdk] Allow for read command to be run on low code connector streams w/o a schema file #18532
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
Merged
Merged
[low-code cdk] Allow for read command to be run on low code connector streams w/o a schema file #18532
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8ead873
use mockschemaloader as the default and rename JsonSchema to JsonFile…
brianjlai 0acada0
Merge branch 'master' into brian/low_code_read_without_schema_file
brianjlai 71b2b58
rename mock to EmptySchemaLoader
brianjlai f23e923
retain existing JsonSchema while hacktoberfest is still in progress
brianjlai 7b9a889
bump version and changelog
brianjlai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,8 @@ | |
from airbyte_cdk.sources.declarative.requesters.paginators.strategies.offset_increment import OffsetIncrement | ||
from airbyte_cdk.sources.declarative.requesters.paginators.strategies.page_increment import PageIncrement | ||
from airbyte_cdk.sources.declarative.retrievers.simple_retriever import SimpleRetriever | ||
from airbyte_cdk.sources.declarative.schema.json_schema import JsonSchema | ||
from airbyte_cdk.sources.declarative.schema import MockSchemaLoader | ||
from airbyte_cdk.sources.declarative.schema.json_file_schema_loader import JsonFileSchemaLoader | ||
from airbyte_cdk.sources.declarative.stream_slicers.cartesian_product_stream_slicer import CartesianProductStreamSlicer | ||
from airbyte_cdk.sources.declarative.stream_slicers.datetime_stream_slicer import DatetimeStreamSlicer | ||
from airbyte_cdk.sources.declarative.stream_slicers.list_stream_slicer import ListStreamSlicer | ||
|
@@ -62,9 +63,10 @@ | |
"HttpRequester": HttpRequester, | ||
"InterpolatedBoolean": InterpolatedBoolean, | ||
"InterpolatedString": InterpolatedString, | ||
"JsonSchema": JsonSchema, | ||
"JsonFileSchemaLoader": JsonFileSchemaLoader, | ||
"ListStreamSlicer": ListStreamSlicer, | ||
"MinMaxDatetime": MinMaxDatetime, | ||
"MockSchemaLoader": MockSchemaLoader, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: I'd replace |
||
"NoAuth": NoAuth, | ||
"NoPagination": NoPagination, | ||
"OAuthAuthenticator": DeclarativeOauth2Authenticator, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
airbyte-cdk/python/airbyte_cdk/sources/declarative/schema/mock_schema_loader.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# | ||
# Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
from dataclasses import InitVar, dataclass | ||
from typing import Any, Mapping | ||
|
||
from airbyte_cdk.sources.declarative.schema.schema_loader import SchemaLoader | ||
from airbyte_cdk.sources.declarative.types import Config | ||
from dataclasses_jsonschema import JsonSchemaMixin | ||
|
||
|
||
@dataclass | ||
class MockSchemaLoader(SchemaLoader, JsonSchemaMixin): | ||
""" | ||
Loads an empty schema for streams that have not defined their schema file yet. | ||
|
||
Attributes: | ||
config (Config): The user-provided configuration as specified by the source's spec | ||
options (Mapping[str, Any]): Additional arguments to pass to the string interpolation if needed | ||
""" | ||
|
||
config: Config | ||
options: InitVar[Mapping[str, Any]] | ||
|
||
def __post_init__(self, options: Mapping[str, Any]): | ||
pass | ||
|
||
def get_json_schema(self) -> Mapping[str, Any]: | ||
""" | ||
Returns by default the empty schema. | ||
|
||
:return: The empty schema | ||
""" | ||
|
||
return {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
is there a worry that this might break existing users?
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.
I scanned through our existing low code implementations and i'm going to migrate them to the new name
JsonFileSchemaLoader
after the CDK is published first. However, on second thought, I think instead of doing the rename now, we'll just bundle this up into a series of cosmetic changes we have slated in November. Even though Hacktober fest is over, some contributors are still making adjustment and we don't want to add unnecessary friction if it can wait