-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
AirbyteLib: More robust error handling, installation improvements #34572
Changes from 6 commits
abbb256
3845f5c
9fccace
a217a6e
6aa85d6
dddbc78
b1d966b
f61152a
d665088
809918b
4a41ffb
bab5e06
10ce077
063bba3
ab75be4
8880b0b
3773149
90918c8
9197728
f73f288
dd9ac99
a2bed01
2e49154
f975282
ace7208
8775c1b
f24226d
7370d83
cfafccc
8446838
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,13 @@ def __init__( | |
name: str, | ||
config: dict[str, Any] | None = None, | ||
streams: list[str] | None = None, | ||
*, | ||
validate: bool = False, | ||
) -> None: | ||
"""Initialize the source. | ||
|
||
If config is provided, it will be validated against the spec if validate is True. | ||
""" | ||
self._processed_records = 0 | ||
self.executor = executor | ||
self.name = name | ||
|
@@ -79,7 +85,7 @@ def __init__( | |
self._spec: ConnectorSpecification | None = None | ||
self._selected_stream_names: list[str] | None = None | ||
if config is not None: | ||
self.set_config(config) | ||
self.set_config(config, validate=validate) | ||
if streams is not None: | ||
self.set_streams(streams) | ||
|
||
|
@@ -102,10 +108,24 @@ def set_streams(self, streams: list[str]) -> None: | |
) | ||
self._selected_stream_names = streams | ||
|
||
def set_config(self, config: dict[str, Any]) -> None: | ||
self._validate_config(config) | ||
def set_config( | ||
self, | ||
config: dict[str, Any], | ||
*, | ||
validate: bool = False, | ||
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. what's the advantage of deferring the check? I thought of it being quite nice as it will tell you as early as possible if your config won't work, instead of waiting for actually invoking. What's the workflow you had in mind here? 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. Discussed in DM. |
||
) -> None: | ||
"""Set the config for the connector. | ||
|
||
If validate is True, raise an exception if the config fails validation. | ||
|
||
If validate is False, validation will be deferred until check() is called. | ||
""" | ||
if validate: | ||
self._validate_config(config) | ||
|
||
self._config_dict = config | ||
|
||
|
||
@property | ||
def _config(self) -> dict[str, Any]: | ||
if self._config_dict is None: | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Looking at the code, by my understanding
AirbyteConnectorNotFoundError
means the connector is not found locally, andAirbyteConnectorNotRegisteredError
means the connector is not found in the registry, but this docstring indicates otherwise.Could you clarify?
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.
Good catch! This was a mistake. I've renamed the error to
AirbyteConnectorExecutableNotFoundError
so it is more explicit.