Prefect - The Python Orchestrator
If you are in data engineering, you will have encoutered Airflow, an orchestration tool for ETL process based on the DAG architecture. A powerful alternative that is purely pythonic exists and it is Prefect. On this series, we focus on small snippets to get us started.
Setup and Installation
To begin we need to install
pip install -U prefect
Let's now check if it is installed
import prefect
from prefect import get_client
print(f"Running Prefect {prefect.__version__}")
Prefect CLI
Once prefect is installed, it, also includes a command line interface that you can leverage for documentation, starting up servers and building your pipelines. For example, below we see how to get the same prefect profile information from the command line.
$ prefect version
Prefect help
The
$ prefect --help
Checking Profiles
Another useful utility function is the profiles function, which allows you to identify and switch between different servers. For now, we have not setup any profiles but it is a handy tool to know.
$ prefect profile ls
Understanding Your Configuration
config view
!prefect config view
This shows you're using the ephemeral profile, which means Prefect is running with an in-memory, temporary API
server. This is great for quick development and testing, but data won't persist between sessions. The
profile inspect
This confirms the active profile is ephemeral and shows the specific settings applied. If you don't specify a profile name, Prefect defaults to 'ephemeral'. When you start a local Prefect server or connect to Prefect Cloud, you'll create and switch to different profiles with different API endpoints and settings.
$ prefect profile inspect
Understanding Your Configuration
config view
!prefect config view
This shows you're using the ephemeral profile, which means Prefect is running with an in-memory, temporary API
server. This is great for quick development and testing, but data won't persist between sessions. The
Inspecting Profiles
This confirms the active profile is ephemeral and shows the specific settings applied. If you don't specify a profile name, Prefect defaults to 'ephemeral'. When you start a local Prefect server or connect to Prefect Cloud, you'll create and switch to different profiles with different API endpoints and settings.
$ prefect profile inspect