Skip to content

Commit

Permalink
Update fetch_fivetran_workspace_data
Browse files Browse the repository at this point in the history
  • Loading branch information
maximearmstrong committed Nov 8, 2024
1 parent 2728dea commit 5c21300
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import os
import time
from enum import Enum
from typing import Any, Mapping, Optional, Sequence, Tuple
from urllib.parse import urljoin

Expand Down Expand Up @@ -43,6 +44,14 @@
DEFAULT_POLL_INTERVAL = 10


class FivetranConnectorSetupStateType(Enum):
"""Enum representing each setup state for a connector in Fivetran's ontology."""

INCOMPLETE = "incomplete"
CONNECTED = "connected"
BROKEN = "broken"


class FivetranResource(ConfigurableResource):
"""This class exposes methods on top of the Fivetran REST API."""

Expand Down Expand Up @@ -643,8 +652,11 @@ def fetch_fivetran_workspace_data(
for connector_details in connectors_details:
connector_id = connector_details["id"]

setup_state = connector_details.get("status", {}).get("setup_state")
if setup_state and setup_state in ("incomplete", "broken"):
setup_state = connector_details["status"]["setup_state"]
if setup_state in (
FivetranConnectorSetupStateType.INCOMPLETE,
FivetranConnectorSetupStateType.BROKEN,
):
continue

schema_config = client.get_schema_config_for_connector(connector_id=connector_id)
Expand Down

0 comments on commit 5c21300

Please sign in to comment.