Skip to main content

prefect-hightouch

PyPI

Welcome!

Prefect integrations for interacting with Hightouch.

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-hightouch with pip:

pip install prefect-hightouch

Then, register to view the block on Prefect Cloud:

prefect block register -m prefect_hightouch.credentials

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

Trigger a sync run and wait for completion

from prefect import flow
from prefect_hightouch import HightouchCredentials
from prefect_hightouch.syncs import trigger_sync_run_and_wait_for_completion
@flow
def sync_flow():
    hightouch_credentials = HightouchCredentials.load("hightouch-token")
    sync_metadata = trigger_sync_run_and_wait_for_completion(
        hightouch_credentials=hightouch_credentials,
        sync_id=12345,
        full_resync=True,
        max_wait_seconds=1800,
        poll_frequency_seconds=10,
    )
    return sync_metadata
sync_flow()

List, get, and trigger syncs

from prefect import flow
from prefect_hightouch import HightouchCredentials, api_models
from prefect_hightouch.syncs import (
    list_sync,
    get_sync,
    list_sync_runs,
    trigger_run,
    trigger_run_custom,
)

@flow
def hightouch_sync_flow():
    hightouch_credentials = HightouchCredentials.load("hightouch-token")

    # list all syncs
    syncs = list_sync(
        hightouch_credentials, order_by=api_models.ListSyncOrderBy.CREATEDAT
    )

    # get first sync
    sync_id = syncs[0].id
    sync = get_sync(hightouch_credentials, sync_id)

    # list previous runs
    sync_runs = list_sync_runs(hightouch_credentials, sync_id)

    # trigger by id
    sync_run = trigger_run(
        hightouch_credentials,
        sync_id,
        json_body=api_models.TriggerRunInput(full_resync=False),
    )

    # trigger by slug
    sync_slug = syncs[0].slug
    sync_run_2 = trigger_run_custom(
        hightouch_credentials,
        json_body=api_models.TriggerRunCustomInput(
            sync_slug=sync_slug,
            full_resync=False,
        ),
    )
    return sync_runs

hightouch_sync_flow()

Call API endpoints

If an API endpoint is not exposed as a task, you can call the underlying API endpoint functions, but note, these are not Prefect tasks.

from prefect_hightouch.credentials import HightouchCredentials
from prefect_hightouch.api_client.api.default import list_destination

credentials = HightouchCredentials.load(token="my-service-token")
client = credentials.get_client()
response = list_destination.sync_detailed(client=client)
data = response.parsed.data

Resources

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

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

Feel free to ⭐️ or watch prefect-hightouch for updates too!

Development

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

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

cd prefect-hightouch/

pip install -e ".[dev]"

# Install linting pre-commit hooks
pre-commit install

Release files for prefect-hightouch 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prefect-hightouch 0.2.1
File Size Uploaded
prefect-hightouch-0.2.1.tar.gz 53.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prefect-hightouch 0.2.1
File Interpreter ABI Platform
prefect_hightouch-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 134.8 kB

Release files / prefect-hightouch-0.2.1.tar.gz

Download URL prefect-hightouch-0.2.1.tar.gz
Size 53.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7bee7e31c49b970591943aa17880a25e506ca94e110382b3e5eb5225d660306c
BLAKE2b-256 checksum
How to use checksums
5e16382328287c771213656e1066f0c9def6ab19a806a8f58c00c65f1591e902
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / prefect_hightouch-0.2.1-py3-none-any.whl

Download URL prefect_hightouch-0.2.1-py3-none-any.whl
Size 81.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7358af61eaa2934dfd8bc05ee99ae13628473a5b9d2d6425a782a4c54656844
BLAKE2b-256 checksum
How to use checksums
529257f00227e459eda8a9a934b2e617e195b19425c804be1a7619b11bd8ade9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page