From 6cd5f9e9bf22b149c82f7bb8e0523342dac685f0 Mon Sep 17 00:00:00 2001 From: Maxime Armstrong Date: Wed, 20 Nov 2024 17:31:14 -0500 Subject: [PATCH] Update FivetranConnectorScheduleType to subclass str --- .../dagster-fivetran/dagster_fivetran/resources.py | 5 +++-- .../dagster-fivetran/dagster_fivetran/translator.py | 10 +--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/python_modules/libraries/dagster-fivetran/dagster_fivetran/resources.py b/python_modules/libraries/dagster-fivetran/dagster_fivetran/resources.py index 1a6f70c30a61f..f8cdf5aeff211 100644 --- a/python_modules/libraries/dagster-fivetran/dagster_fivetran/resources.py +++ b/python_modules/libraries/dagster-fivetran/dagster_fivetran/resources.py @@ -608,9 +608,10 @@ def update_schedule_type_for_connector( Returns: Dict[str, Any]: Parsed json data representing the API response. """ - if not FivetranConnectorScheduleType.has_value(schedule_type): + schedule_types = {s for s in FivetranConnectorScheduleType} + if schedule_type not in schedule_types: check.failed( - f"The schedule_type for a connector must be in {FivetranConnectorScheduleType.values()}: " + f"The schedule_type for a connector must be in {schedule_types}: " f"got '{schedule_type}'" ) return self._make_connector_request( diff --git a/python_modules/libraries/dagster-fivetran/dagster_fivetran/translator.py b/python_modules/libraries/dagster-fivetran/dagster_fivetran/translator.py index 2d591dd09edcb..5011c1a09a073 100644 --- a/python_modules/libraries/dagster-fivetran/dagster_fivetran/translator.py +++ b/python_modules/libraries/dagster-fivetran/dagster_fivetran/translator.py @@ -23,20 +23,12 @@ class FivetranConnectorTableProps(NamedTuple): service: Optional[str] -class FivetranConnectorScheduleType(Enum): +class FivetranConnectorScheduleType(str, Enum): """Enum representing each schedule type for a connector in Fivetran's ontology.""" AUTO = "auto" MANUAL = "manual" - @classmethod - def has_value(cls, value) -> bool: - return value in cls._value2member_map_ - - @classmethod - def values(cls) -> Sequence[str]: - return list(cls._value2member_map_.keys()) - class FivetranConnectorSetupStateType(Enum): """Enum representing each setup state for a connector in Fivetran's ontology."""