Registry /
workflow / apache-airflow-providers-presto
Install & Compatibility
Where this runs
tested against v5.12.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 5.387s · 402.2MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 27.5s · import 4.977s · 395MB
375MB installed
● package 375MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
PrestoHook
✓ from airflow.providers.presto.hooks.presto import PrestoHook
✗ from airflow.contrib.hooks.presto_hook import PrestoHook
Old import path used before Airflow 2.0 and the provider package system.
PrestoOperator
✓ from airflow.providers.presto.operators.presto import PrestoOperator
✗ from airflow.contrib.operators.presto_operator import PrestoOperator
Old import path used before Airflow 2.0 and the provider package system.
This quickstart demonstrates a basic Airflow DAG that uses the `PrestoOperator` to execute SQL queries against a Presto/Trino database. It shows how to define tasks with a specified `presto_conn_id` (e.g., `presto_default`) and execute both static and templated SQL. Ensure your Airflow environment has a connection named 'presto_default' configured via the UI or environment variables for this DAG to run successfully.
import os
from datetime import datetime
from airflow.models.dag import DAG
from airflow.providers.presto.operators.presto import PrestoOperator
# For local testing, ensure 'presto_default' connection is set up in Airflow UI,
# or define it via environment variables (e.g., in a .env file or shell):
# export AIRFLOW_CONN_PRESTO_DEFAULT='presto://user:password@localhost:8080/hive/default'
# For Trino specific parameters (e.g., auth, TLS):
# export AIRFLOW_CONN_PRESTO_DEFAULT='trino://user@localhost:8080/?catalog=hive&schema=default&auth=NONE'
with DAG(
dag_id="presto_example_dag",
start_date=datetime(2023, 1, 1),
schedule=None,
catchup=False,
tags=["presto", "trino", "example"],
) as dag:
run_simple_query = PrestoOperator(
task_id="execute_select_one",
presto_conn_id="presto_default", # Ensure this connection ID exists in Airflow
sql="SELECT 1",
)
run_templated_query = PrestoOperator(
task_id="execute_templated_query",
presto_conn_id="presto_default",
sql="SELECT '{{ ds }}' as current_date_string, '{{ macros.uuid.uuid4() }}' as random_uuid",
)
Debug
Known issues
breakingThe Presto provider was moved from `airflow.contrib` to its own provider package `apache-airflow-providers-presto` with Airflow 2.0.fixUpdate import paths from `airflow.contrib.hooks.presto_hook` or `airflow.contrib.operators.presto_operator` to `airflow.providers.presto.hooks.presto` and `airflow.providers.presto.operators.presto` respectively. Install the `apache-airflow-providers-presto` package.
affects: Apache Airflow < 2.0 and apache-airflow-providers-presto < 1.0
gotchaThe provider package is named 'presto', but it uses the 'trino' Python client library and is fully compatible with Trino (formerly PrestoSQL). While the hook/operator classes retain 'Presto' in their names, connection parameters and client behavior align with Trino.fixBe aware that connection parameters (e.g., `catalog`, `schema`, authentication methods) should align with Trino client conventions. When troubleshooting, search for 'Trino' client errors or documentation.
affects: All versions
gotchaIncorrectly formatted Presto/Trino connection strings are a common source of errors, especially when including catalog, schema, or advanced authentication (e.g., Kerberos, OAuth) parameters.fixRefer to the `trino` Python client documentation for the exact connection string format, especially for URL parameters and authentication options. Test connections outside Airflow using the `trino` client directly if issues persist to isolate the problem.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'airflow.providers.presto'
The `apache-airflow-providers-presto` package has not been installed in your Airflow environment.
fixInstall the provider package: `pip install apache-airflow-providers-presto`
airflow.exceptions.AirflowException: The conn_id `presto_default` isn't defined
The Airflow connection with the specified ID (e.g., 'presto_default') has not been configured in your Airflow instance.
fixDefine the connection in the Airflow UI (Admin -> Connections -> Create) or by setting the corresponding environment variable (e.g., `AIRFLOW_CONN_PRESTO_DEFAULT='presto://user:password@host:port/catalog/schema'`).
trino.exceptions.TrinoUserError: Catalog '...' not found
The specified catalog or schema in the SQL query or connection parameters does not exist or is inaccessible on the Presto/Trino server.
fixVerify the 'catalog' and 'schema' parameters in your connection string or `PrestoOperator` arguments. Ensure the Presto/Trino server is running and configured correctly with the necessary catalogs.
trino.exceptions.TrinoConnectionError: Connection refused
The Airflow worker cannot establish a connection to the specified Presto/Trino server. This could be due to an incorrect host/port, network issues, or the server being down.
fixCheck the `host` and `port` in your Airflow connection configuration. Verify network connectivity between the Airflow worker and the Presto/Trino server, and ensure the Presto/Trino server is running.
Upgrade
Version history
5.12.0latest on PyPI · released May 23, 2026
Audit
Dependencies
trinorequiredRequired for Presto/Trino database client connectivity.