Skip to main content

Prefect integrations for interacting with Hex.

Project description


Visit the full docs here to see additional examples and the API reference.



Prefect integrations for interacting with Hex.

Hex is a powerful platform for collaborative data science and analytics. For information getting started with Hex, check out Hex's quickstart guide.

The tasks within this collection were created by a code generator using Hex's OpenAPI spec.

Hex's REST API documentation can be found here.

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.


Install prefect-hex with pip:

pip install prefect-hex

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

Gather and store authentication

  1. Create new token on Settings page:


  1. Store token on Blocks page:


  1. Copy project ID from browser URL (in red):


Write and run a flow

Trigger a Hex project run and wait for completion

from prefect import flow
from prefect_hex import HexCredentials
from prefect_hex.project import trigger_project_run_and_wait_for_completion

def trigger_project_run_and_wait_for_completion_flow(project_id: str):
    hex_credentials = HexCredentials.load("hex-token")
    project_metadata = trigger_project_run_and_wait_for_completion(
    return project_metadata


Run project, get status, cancel run, and get list of projects

from prefect import flow
from prefect_hex import HexCredentials
from prefect_hex.project import (

def example_hex_flow():
    # load stored credentials
    hex_credentials = HexCredentials.load("hex-token")

    # run project
    project_run = run_project(project_id=project_id, hex_credentials=hex_credentials)

    # get status
    run_id = project_run.run_id
    project_run_status = get_run_status(
        project_id=project_id, run_id=run_id, hex_credentials=hex_credentials

    # cancel run if needed
    cancel_run(project_id=project_id, run_id=run_id, hex_credentials=hex_credentials)

    # get list of project runs
    project_runs = get_project_runs(
        project_id=project_id, hex_credentials=hex_credentials

    return project_runs


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


Blog Posts


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

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

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


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

-cd prefect-hex/ Here are the steps:

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

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-hex-0.1.1.tar.gz (33.4 kB view hashes)

Uploaded source

Built Distribution

prefect_hex-0.1.1-py3-none-any.whl (16.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page