Skip to main content

A Fivetran Activations provider for Apache Airflow

Project description

Fivetran Activations Provider for Apache Airflow

This package lets you trigger and monitor Fivetran Activations (formerly Census) syncs from Apache Airflow.

Support Matrix

  • Python: >=3.10
  • Apache Airflow: >=2.10,<4
  • Airflow authoring compatibility: Airflow 2.10+ and 3.x

Airflow 3 Highlights

This provider supports Apache Airflow 2.10+ and 3.x from one package.

Airflow 3-friendly capabilities include:

  • deferrable CensusSensor support so long-running sync polling does not hold a worker slot
  • Airflow connection testing support in the UI and CLI via test_connection()

For backward compatibility, the provider still uses the existing CensusHook, CensusOperator, CensusSensor, and census connection type names even though the product is now Fivetran Activations.

Installation

Install the package from PyPI with your preferred Python package manager.

pip install airflow-provider-census

Connection Setup

The provider uses the census_default connection ID by default.

Create a connection in the Airflow UI with:

  • Conn Id: census_default
  • Conn Type: Census (kept for backward compatibility)
  • Host: app.getcensus.com for US workspaces or app-eu.getcensus.com for EU workspaces
  • Activations API Token: your Fivetran Activations API token

The hook implements test_connection(), so Airflow's Test Connection button and airflow connections test CLI command can validate the setup.

Hooks

from airflow_provider_census.hooks.census import CensusHook

CensusHook extends HttpHook and provides helpers to:

  • trigger a sync run
  • fetch sync run status
  • test the Airflow connection configuration

Operator

from airflow_provider_census.operators.census import CensusOperator

CensusOperator triggers a Fivetran Activations sync run and returns the resulting sync_run_id via XCom.

Parameters:

  • sync_id: the Fivetran Activations sync ID, for example from https://app.getcensus.com/syncs/<SYNC_ID>/overview
  • census_conn_id: optional connection ID, defaults to census_default

The operator also exposes a Fivetran Activations Sync Run task link in the Airflow UI.

Sensor

from airflow_provider_census.sensors.census import CensusSensor

CensusSensor waits for a Fivetran Activations sync run to complete.

Parameters:

  • sync_run_id: the sync run ID returned by CensusOperator
  • census_conn_id: optional connection ID, defaults to census_default
  • deferrable: when True, defers polling to the triggerer instead of holding a worker slot

When deferrable=True, your Airflow deployment must be running a triggerer.

Example DAG

from datetime import datetime
from datetime import timedelta

from airflow.providers.common.compat.sdk import DAG

from airflow_provider_census.operators.census import CensusOperator
from airflow_provider_census.sensors.census import CensusSensor

with DAG(
    dag_id="example_census",
    start_date=datetime(2024, 1, 1),
    schedule="@daily",
    catchup=False,
    max_active_runs=1,
    default_args={
        "owner": "airflow",
        "retries": 1,
        "retry_delay": timedelta(minutes=5),
    },
) as dag:
    trigger_sync = CensusOperator(
        task_id="trigger_sync",
        census_conn_id="census_default",
        sync_id=27,
    )

    wait_for_sync = CensusSensor(
        task_id="wait_for_sync",
        sync_run_id="{{ ti.xcom_pull(task_ids='trigger_sync') }}",
        census_conn_id="census_default",
        deferrable=True,
    )

    trigger_sync >> wait_for_sync

API Documentation

The Activations Management API reference now lives in Fivetran documentation:

Feedback

Source code: https://github.com/sutrolabs/airflow-provider-census

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

airflow_provider_census-2.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

airflow_provider_census-2.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file airflow_provider_census-2.1.0.tar.gz.

File metadata

File hashes

Hashes for airflow_provider_census-2.1.0.tar.gz
Algorithm Hash digest
SHA256 3f6adfac03cb469558d4d3fb763cbe61922bf8fd14161b42ae4c99ee91c244d2
MD5 f2f92ec430ad794fd472e3d4988817e1
BLAKE2b-256 b2c3e60ebd68d9a081cef9950f3cba1bfff23f1ee1b241eaf50ed74bd43763ba

See more details on using hashes here.

File details

Details for the file airflow_provider_census-2.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for airflow_provider_census-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0756c0b09a261d93438981886108d1c7b383bcc20c1b1333e47d6eda655ae8d6
MD5 33beac58f63c3dcbb407a88d13a16090
BLAKE2b-256 0553b095dce712bb92c04cf91f379252f7a2e02228380ab40a0a44f7dff1ad4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page