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

🐛 Source File: fix check method #18481

Merged
merged 5 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-file/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ COPY source_file ./source_file
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.2.26
LABEL io.airbyte.version=0.2.27
LABEL io.airbyte.name=airbyte/source-file
15 changes: 13 additions & 2 deletions airbyte-integrations/connectors/source-file/source_file/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,23 @@ def check(self, logger, config: Mapping) -> AirbyteConnectionStatus:
"""
config = self._validate_and_transform(config)
client = self._get_client(config)
logger.info(f"Checking access to {client.reader.full_url}...")
source_url = client.reader.full_url
artem1205 marked this conversation as resolved.
Show resolved Hide resolved
logger.info(f"Checking access to {source_url}...")
if "docs.google.com/spreadsheets" in source_url:
reason = f"Failed to load {source_url}: please use the Official Google Sheets Source connector"
logger.error(reason)
return AirbyteConnectionStatus(status=Status.FAILED, message=reason)
try:
with client.reader.open():
list(client.streams)
return AirbyteConnectionStatus(status=Status.SUCCEEDED)
except (TypeError, ValueError) as err:
reason = f"Failed to load {source_url}\n Please check File Format and Reader Options are set correctly" \
f"\n{repr(err)}\n{traceback.format_exc()}"
logger.error(reason)
return AirbyteConnectionStatus(status=Status.FAILED, message=reason)
except Exception as err:
reason = f"Failed to load {client.reader.full_url}: {repr(err)}\n{traceback.format_exc()}"
reason = f"Failed to load {source_url}: {repr(err)}\n{traceback.format_exc()}"
logger.error(reason)
return AirbyteConnectionStatus(status=Status.FAILED, message=reason)

Expand Down