-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[11/n][dagster-fivetran] Implement materialization method in Fivetran…
…Workspace (#25961) ## Summary & Motivation This PR implements `FivetranWorkspace.sync_and_poll`, the materialization method for Fivetran assets. This method: - calls `FivetranClient.sync_and_poll` - takes the FivetranOutput returned by `FivetranClient.sync_and_poll` and generates the asset materializations - yields `MaterializeResult` for each expected asset and `AssetMaterialization` for each unexpected asset - a connector table that was not in the connector at definitions loading time can be in the FivetranOutput. Eg. the table was added after definitions loading time and before sync. - logs a warning for each unmaterialized table - a connector table can be created at definitions loading time, but can be missing in the FivetranOutput. Eg. the table was deleted after definitions loading time and before sync. Can be leveraged like: ```python from dagster_fivetran import FivetranWorkspace, fivetran_assets import dagster as dg fivetran_workspace = FivetranWorkspace( account_id=dg.EnvVar("FIVETRAN_API_KEY"), api_key=dg.EnvVar("FIVETRAN_API_KEY"), api_secret=dg.EnvVar("FIVETRAN_API_SECRET"), ) @fivetran_assets( connector_id="connector_id", name="connector_id", group_name="connector_id", workspace=fivetran_workspace, ) def fivetran_connector_assets(context: dg.AssetExecutionContext, fivetran: FivetranWorkspace): yield from fivetran.sync_and_poll(context=context) defs = dg.Definitions( assets=[fivetran_connector_assets], resources={"fivetran": fivetran_workspace}, ) ``` ## How I Tested These Changes Additional tests with BK Tested with a live Fivetran instance: <img width="1251" alt="Screenshot 2024-11-26 at 5 46 31 PM" src="https://github.com/user-attachments/assets/e4253119-045f-4ac7-8b98-eb805e24a843"> ## Changelog [dagster-fivetran]
- Loading branch information
1 parent
a0f9496
commit f6a914b
Showing
5 changed files
with
405 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.