From 32e5be0be2d01dbfc1db87d35ba96efba034a23c Mon Sep 17 00:00:00 2001 From: Maxime Armstrong <46797220+maximearmstrong@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:21:56 -0500 Subject: [PATCH] [dagster-fivetran] Remove OpExecutionContext support in FivetranWorkspace.sync_and_poll (#26585) ## Summary & Motivation Following [this discussion](https://github.com/dagster-io/dagster/pull/26432#discussion_r1890538958) for Airbyte Cloud - `FivetranWorkspace.sync_and_poll` should only accept context of type `AssetExecutionContext`. ## How I Tested These Changes Same tests with BK --- .../dagster-fivetran/dagster_fivetran/resources.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/python_modules/libraries/dagster-fivetran/dagster_fivetran/resources.py b/python_modules/libraries/dagster-fivetran/dagster_fivetran/resources.py index 82b36a45ad1bd..f56b0da16ce8f 100644 --- a/python_modules/libraries/dagster-fivetran/dagster_fivetran/resources.py +++ b/python_modules/libraries/dagster-fivetran/dagster_fivetran/resources.py @@ -16,7 +16,6 @@ InitResourceContext, MaterializeResult, MetadataValue, - OpExecutionContext, __version__, _check as check, get_dagster_logger, @@ -1014,14 +1013,14 @@ def _generate_materialization( ) def sync_and_poll( - self, context: Union[OpExecutionContext, AssetExecutionContext] + self, context: AssetExecutionContext ) -> FivetranEventIterator[Union[AssetMaterialization, MaterializeResult]]: """Executes a sync and poll process to materialize Fivetran assets. + This method can only be used in the context of an asset execution. Args: - context (Union[OpExecutionContext, AssetExecutionContext]): The execution context - from within `@fivetran_assets`. If an AssetExecutionContext is passed, - its underlying OpExecutionContext will be used. + context (AssetExecutionContext): The execution context + from within `@fivetran_assets`. Returns: Iterator[Union[AssetMaterialization, MaterializeResult]]: An iterator of MaterializeResult @@ -1031,7 +1030,7 @@ def sync_and_poll( events=self._sync_and_poll(context=context), fivetran_workspace=self, context=context ) - def _sync_and_poll(self, context: Union[OpExecutionContext, AssetExecutionContext]): + def _sync_and_poll(self, context: AssetExecutionContext): assets_def = context.assets_def dagster_fivetran_translator = get_translator_from_fivetran_assets(assets_def) connector_id = next(