dagster-fivetran library
This library provides a Dagster integration with Fivetran.
Component
classdagster_fivetran.FivetranAccountComponent [source]Loads Fivetran connectors from a given Fivetran instance as Dagster assets. Materializing these assets will trigger a sync of the Fivetran connector, enabling you to schedule Fivetran syncs using Dagster.
Example:
# defs.yaml
type: dagster_fivetran.FivetranAccountComponent
attributes:
workspace:
account_id: your_account_id
api_key: "{{ env.FIVETRAN_API_KEY }}"
api_secret: "{{ env.FIVETRAN_API_SECRET }}"
connector_selector:
by_name:
- my_postgres_connector
- my_snowflake_connector- execute [source]
Executes a Fivetran sync for the selected connector.
This method can be overridden in a subclass to customize the sync execution behavior, such as adding custom logging or handling sync results differently.
Parameters:
- context – The asset execution context provided by Dagster
- fivetran – The FivetranWorkspace resource used to trigger and monitor syncs
Yields: AssetMaterialization or MaterializeResult events from the Fivetran sync
Example:
Override this method to add custom logging during sync execution:
from dagster_fivetran import FivetranAccountComponent
import dagster as dg
class CustomFivetranAccountComponent(FivetranAccountComponent):
def execute(self, context, fivetran):
context.log.info("Starting Fivetran sync")
yield from super().execute(context, fivetran)
context.log.info("Fivetran sync completed successfully")
- get_asset_spec [source]
Generates an AssetSpec for a given Fivetran connector table.
This method can be overridden in a subclass to customize how Fivetran connector tables are converted to Dagster asset specs. By default, it delegates to the configured DagsterFivetranTranslator.
Parameters: props – The FivetranConnectorTableProps containing information about the connector and destination table being syncedReturns: An AssetSpec that represents the Fivetran connector table as a Dagster asset
Example:
Override this method to add custom tags based on connector properties:
from dagster_fivetran import FivetranAccountComponent
import dagster as dg
class CustomFivetranAccountComponent(FivetranAccountComponent):
def get_asset_spec(self, props):
base_spec = super().get_asset_spec(props)
return base_spec.replace_attributes(
tags={
**base_spec.tags,
"connector_type": props.connector_type,
"destination": props.destination_name
}
)
To use the Fivetran component, see the Fivetran component integration guide.
YAML configuration
When you scaffold a Fivetran component definition, the following defs.yaml configuration file will be created:
type: dagster_fivetran.FivetranAccountComponent
attributes:
workspace:
account_id: test_account
api_key: '{{ env.FIVETRAN_API_KEY }}'
api_secret: '{{ env.FIVETRAN_API_SECRET }}'