Skip to content




prefect-airbyte is a collection of prebuilt Prefect tasks and flows that can be used to quickly construct Prefect flows to interact with Airbyte.

Getting Started

Python setup

Requires an installation of Python 3.7+

We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.

These tasks are designed to work with Prefect 2.0. For more information about how to use Prefect, please refer to the Prefect documentation.

Airbyte setup

See the airbyte documention on how to get your own instance.


Install prefect-airbyte

pip install prefect-airbyte

A list of available blocks in prefect-airbyte and their setup instructions can be found here.


Create an AirbyteServer block and save it

from prefect_airbyte.server import AirbyteServer

# running airbyte locally at http://localhost:8000 with default auth
local_airbyte_server = AirbyteServer()

# running airbyte remotely at http://<someIP>:<somePort> as user `Marvin`
remote_airbyte_server = AirbyteServer(

Trigger a defined connection sync

from prefect import flow
from prefect_airbyte.server import AirbyteServer
from prefect_airbyte.connections import AirbyteConnection
from prefect_airbyte.flows import run_connection_sync

server = AirbyteServer(server_host="localhost", server_port=8000)

connection = AirbyteConnection(

def airbyte_syncs():
    # do some setup

    sync_result = run_connection_sync(

    # do some other things, like trigger DBT based on number of records synced
    print(f'Number of Records Synced: {sync_result.records_synced}')
❯ python
03:46:03 | prefect.engine - Created flow run 'thick-seahorse' for flow 'example_trigger_sync_flow'
03:46:03 | Flow run 'thick-seahorse' - Using task runner 'ConcurrentTaskRunner'
03:46:03 | Flow run 'thick-seahorse' - Created task run 'trigger_sync-35f0e9c2-0' for task 'trigger_sync'
03:46:03 | prefect - trigger airbyte connection: e1b2078f-882a-4f50-9942-cfe34b2d825b, poll interval 3 seconds
03:46:03 | prefect - pending
03:46:06 | prefect - running
03:46:09 | prefect - running
03:46:12 | prefect - running
03:46:16 | prefect - running
03:46:19 | prefect - running
03:46:22 | prefect - Job 26 succeeded.
03:46:22 | Task run 'trigger_sync-35f0e9c2-0' - Finished in state Completed(None)
03:46:22 | Flow run 'thick-seahorse' - Finished in state Completed('All states completed.')

Export an Airbyte instance's configuration

NOTE: The API endpoint corresponding to this task is no longer supported by open-source Airbyte versions as of v0.40.7. Check out the Octavia CLI docs for more info.

import gzip

from prefect import flow, task
from prefect_airbyte.configuration import export_configuration
from prefect_airbyte.server import AirbyteServer

def zip_and_write_somewhere(
      airbyte_config: bytearray,
      somewhere: str,
    with, 'wb') as f:

def example_export_configuration_flow(filepath: str):

    # Run other tasks and subflows here

    airbyte_config = export_configuration(


if __name__ == "__main__":

Use with_options to customize options on any existing task or flow

from prefect import flow
from prefect_airbyte.connections import AirbyteConnection
from prefect_airbyte.flows import run_connection_sync

custom_run_connection_sync = run_connection_sync.with_options(
    name="Custom Airbyte Sync Flow",

 def some_airbyte_flow():


For more tips on how to use tasks and flows in a Collection, check out Using Collections!

Blocks Catalog

Below is a list of Blocks available for registration in prefect-airbyte.

To register blocks in this module to view and edit them on Prefect Cloud:

prefect block register -m prefect_airbyte
Note, to use the load method on Blocks, you must already have a block document saved through code or saved through the UI.

Server Module


To load the AirbyteServer:

from prefect import flow
from prefect_airbyte.server import AirbyteServer

def my_flow():
    my_block = AirbyteServer.load("MY_BLOCK_NAME")


Connections Module


To load the AirbyteConnection:

from prefect import flow
from prefect_airbyte.connections import AirbyteConnection

def my_flow():
    my_block = AirbyteConnection.load("MY_BLOCK_NAME")



If you encounter and bugs while using prefect-airbyte, feel free to open an issue in the prefect-airbyte repository.

If you have any questions or issues while using prefect-airbyte, you can find help in either the Prefect Discourse forum or the Prefect Slack community

Feel free to star or watch prefect-airbyte for updates too!


If you'd like to help contribute to fix an issue or add a feature to prefect-airbyte, please propose changes through a pull request from a fork of the repository.

Contribution Steps:

  1. Fork the repository
  2. Clone the forked repository
  3. Install the repository and its dependencies:
    pip install -e ".[dev]"
  4. Make desired changes.
  5. Add tests.
  6. Insert an entry to
  7. Install pre-commit to perform quality checks prior to commit: pre-commit install
  8. git commit, git push, and create a pull request.