Skip to content

CDK: updated error message for missing streams #36833

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 4 commits into from
Apr 4, 2024
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
13 changes: 10 additions & 3 deletions airbyte-cdk/python/airbyte_cdk/sources/abstract_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,16 @@ def read(
if not stream_instance:
if not self.raise_exception_on_missing_stream:
continue
raise KeyError(
f"The stream {configured_stream.stream.name} no longer exists in the configuration. "
f"Refresh the schema in replication settings and remove this stream from future sync attempts."

error_message = (
f"The stream '{configured_stream.stream.name}' in your connection configuration was not found in the source. "
f"Refresh the schema in your replication settings and remove this stream from future sync attempts."
)

raise AirbyteTracedException(
message="A stream listed in your configuration was not found in the source. Please check the logs for more details.",
internal_message=error_message,
failure_type=FailureType.config_error,
)

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
from abc import ABC
from typing import Any, Iterator, List, Mapping, MutableMapping, Optional, Union

from airbyte_cdk.models import AirbyteMessage, AirbyteStateMessage, ConfiguredAirbyteCatalog
from airbyte_cdk.models import AirbyteMessage, AirbyteStateMessage, ConfiguredAirbyteCatalog, FailureType
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.concurrent_source.concurrent_source import ConcurrentSource
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.sources.streams.concurrent.abstract_stream import AbstractStream
from airbyte_cdk.sources.streams.concurrent.abstract_stream_facade import AbstractStreamFacade
from airbyte_cdk.utils.traced_exception import AirbyteTracedException


class ConcurrentSourceAdapter(AbstractSource, ABC):
Expand Down Expand Up @@ -54,10 +55,18 @@ def _select_abstract_streams(self, config: Mapping[str, Any], configured_catalog
if not stream_instance:
if not self.raise_exception_on_missing_stream:
continue
raise KeyError(
f"The stream {configured_stream.stream.name} no longer exists in the configuration. "
f"Refresh the schema in replication settings and remove this stream from future sync attempts."

error_message = (
f"The stream '{configured_stream.stream.name}' in your connection configuration was not found in the source. "
f"Refresh the schema in your replication settings and remove this stream from future sync attempts."
)

raise AirbyteTracedException(
message="A stream listed in your configuration was not found in the source. Please check the logs for more details.",
internal_message=error_message,
failure_type=FailureType.config_error,
)

if isinstance(stream_instance, AbstractStreamFacade):
abstract_streams.append(stream_instance.get_underlying_stream())
return abstract_streams
Loading