Skip to main content

prefect-airbyte contains tasks for interacting with Airbyte instances

Project description

prefect-airbyte

Welcome!

prefect-airbyte is a collections of prebuilt Prefect tasks that can be used to quickly construct Prefect flows.

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.

Installation

Install prefect-airbyte

pip install prefect-airbyte

Airbyte setup

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

Examples

Trigger a defined connection sync

from prefect import flow
from prefect_airbyte.connections import trigger_sync


@flow
def example_trigger_sync_flow():

      # Run other tasks and subflows here

      trigger_sync(
            connection_id="your-connection-id-to-sync",
            poll_interval_s=3,
            status_updates=True
      )

example_trigger_sync_flow()
❯ python airbyte_syncs.py
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

import gzip

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

@task
def zip_and_write_somewhere(
      airbyte_config: bytearray,
      somewhere: str,
):
    with gzip.open(somewhere, 'wb') as f:
        f.write(airbyte_config)

@flow
def example_export_configuration_flow(filepath: str):

    # Run other tasks and subflows here

    airbyte_config = export_configuration(
        airbyte_server_host="localhost",
        airbyte_server_port="8000",
        airbyte_api_version="v1",
    )

    zip_and_write_somewhere(
        somewhere=filepath,
        airbyte_config=airbyte_config
    )

if __name__ == "__main__":
    example_export_configuration_flow('*://**/my_destination.gz')

Resources

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

Development

If you'd like to install a version of prefect-airbyte for development, first clone the repository and then perform an editable install with pip:

git clone https://github.com/PrefectHQ/prefect-airbyte.git

cd prefect-airbyte/

pip install -e ".[dev]"

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

prefect-airbyte-0b3.tar.gz (28.4 kB view details)

Uploaded Source

Built Distribution

prefect_airbyte-0b3-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file prefect-airbyte-0b3.tar.gz.

File metadata

  • Download URL: prefect-airbyte-0b3.tar.gz
  • Upload date:
  • Size: 28.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for prefect-airbyte-0b3.tar.gz
Algorithm Hash digest
SHA256 3f7d361ef8f9ca9d758aa9feaf1857cd7b23577c878cf94058734529fdacbd31
MD5 aa4131d7e2b49444d1bbfb544dc3e2bb
BLAKE2b-256 3a8d60ce907132b98f21e12bea12dce5104412250c1d4206f3ef972587217f6d

See more details on using hashes here.

File details

Details for the file prefect_airbyte-0b3-py3-none-any.whl.

File metadata

File hashes

Hashes for prefect_airbyte-0b3-py3-none-any.whl
Algorithm Hash digest
SHA256 5b837a514b5eebb6fd2533fd35cdb5a8dc8b2eab311d0c8ed063a6767cb8cd5c
MD5 be2b49494b85a627544a757e1f9c8a7d
BLAKE2b-256 78589c42b924896b1e3b4de7ff2591d1a8e57fb9b2589e82970402b815f1e93c

See more details on using hashes here.

Supported by

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