Registry / workflow / apache-airflow-providers-apache-hive

apache-airflow-providers-apache-hive

JSON →
library9.5.0pypypi✓ verified 85d ago

The `apache-airflow-providers-apache-hive` package provides Apache Airflow operators, hooks, and sensors for interacting with Apache Hive. It supports both HiveServer2 connections (via `HiveHook`) and direct Hive CLI execution (via `HiveCliHook`). Currently at version 9.4.2, it follows the Apache Airflow providers release cycle, typically releasing new versions quarterly or as needed with Airflow major/minor releases.

pip install apache-airflow-providers-apache-hive
INSTALL
IMPORT
SIG · APACHE-AIRFLOW-PRO
A
apache-airflow-providers-apache-hive
workflowpythonv9.5.0
Install
32.3s avg
Import
5043ms
Disk
389MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v9.5.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
musl
py 3.103.960 runs
installs and imports cleanly · install 0.0s · import 5.236s · 414.9MB
glibc
py 3.103.960 runs
installs and imports cleanly · install 32.3s · import 4.850s · 408MB
389MB installed
● package 389MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HiveOperator
from airflow.providers.apache.hive.operators.hive import HiveOperator
from airflow.contrib.operators.hive_operator import HiveOperator
Old contrib import for Airflow 1.x
HiveCliOperator
from airflow.providers.apache.hive.operators.hive_cli import HiveCliOperator
from airflow.contrib.operators.hive_cli_operator import HiveCliOperator
Old contrib import for Airflow 1.x
HiveHook
from airflow.providers.apache.hive.hooks.hive import HiveHook
from airflow.contrib.hooks.hive_hook import HiveHook
Old contrib import for Airflow 1.x
HiveCliHook
from airflow.providers.apache.hive.hooks.hive_cli import HiveCliHook
from airflow.contrib.hooks.hive_cli_hook import HiveCliHook
Old contrib import for Airflow 1.x
HivePartitionSensor
from airflow.providers.apache.hive.sensors.hive_partition import HivePartitionSensor
from airflow.contrib.sensors.hive_partition_sensor import HivePartitionSensor
Old contrib import for Airflow 1.x

This quickstart demonstrates a basic DAG using `HiveOperator` to execute HQL (Hive Query Language). It uses `hive_cli_conn_id='hive_cli_default'` which typically relies on the `hive` CLI being available in the Airflow worker's environment. For connecting to HiveServer2, configure a Hive connection in Airflow UI (e.g., `hive_default`) and use `hive_conn_id='hive_default'` in the operator, ensuring `pyhive` is installed.

from __future__ import annotations import pendulum from airflow.models.dag import DAG from airflow.providers.apache.hive.operators.hive import HiveOperator with DAG( dag_id='hive_example_dag', start_date=pendulum.datetime(2023, 1, 1, tz="UTC"), catchup=False, schedule=None, tags=['hive', 'example'], ) as dag: # Example of running a Hive query via HiveServer2 (requires 'hive_conn_id' and PyHive) run_hive_query = HiveOperator( task_id='run_hive_query', hive_cli_conn_id='hive_cli_default', # Or 'hive_default' for HiveServer2 connection hql=''' CREATE TABLE IF NOT EXISTS my_test_table ( id INT, name STRING ); INSERT INTO TABLE my_test_table VALUES (1, 'Alice'); SELECT COUNT(*) FROM my_test_table; ''', # schema='default' # Optional: Specify the target schema )
Debug
Known issues
breakingAirflow 1.x `contrib` operators/hooks were moved to provider packages in Airflow 2.x. Direct imports from `airflow.contrib` will fail.
fix
Update all imports from `airflow.contrib.operators.hive_operator` or similar to `airflow.providers.apache.hive.operators.hive` and corresponding paths for hooks and sensors.
affects: Airflow 2.0.0 and newer, apache-airflow-providers-apache-hive versions 1.0.0 and newer.
gotchaDistinction between `HiveCliOperator` (or `HiveOperator` with `hive_cli_conn_id`) and `HiveOperator` (with `hive_conn_id`). They use different underlying mechanisms and require different connection configurations.
fix
`HiveCliOperator` (and `HiveOperator` using `hive_cli_conn_id`) expects the `hive` command-line tool to be available on the Airflow worker and configured correctly. `HiveOperator` using `hive_conn_id` (HiveServer2) requires a DBAPI driver like `pyhive` and a proper HiveServer2 connection setup in Airflow UI.
affects: All versions of `apache-airflow-providers-apache-hive`.
gotchaMissing required underlying Python libraries for HiveServer2 connections (e.g., `pyhive`, `thrift-sasl`).
fix
Install the necessary extras or packages: `pip install apache-airflow-providers-apache-hive[kerberos]` or manually `pip install pyhive thrift-sasl`. The specific requirements depend on the connection type (e.g., Kerberos, LDAP).
affects: All versions where `HiveHook` (used by `HiveOperator` with `hive_conn_id`) is used.
gotchaComplexities with Kerberos authentication for Hive connections.
fix
Ensure Kerberos client (`kinit`) is properly configured on the Airflow worker, keytabs are accessible, and `KRB5_KTNAME` environment variable is set if using a non-default keytab path. Also, install `apache-airflow-providers-apache-hive[kerberos]` and configure the Hive connection in Airflow UI with the 'Auth Mechanism' set to 'Kerberos'.
affects: All versions.
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyhive'
The `HiveHook` (used for HiveServer2 connections) requires the `pyhive` library, which is not a direct dependency of the provider package.
fix
Install `pyhive` along with the provider: `pip install apache-airflow-providers-apache-hive[kerberos]` (if using Kerberos) or `pip install pyhive` if not using any specific extras.
airflow.exceptions.AirflowException: Could not find `hive` command in the PATH. Please ensure Hive CLI is installed and configured.
The `HiveCliOperator` or `HiveOperator` configured to use `hive_cli_conn_id` cannot locate the `hive` command-line interface on the Airflow worker.
fix
Install Apache Hive client utilities on the Airflow worker machine and ensure the `hive` executable is in the system's PATH environment variable. Alternatively, switch to using `hive_conn_id` and `HiveOperator` with a HiveServer2 connection and `pyhive`.
pyhive.exc.OperationalError: TTransportException: Could not connect to ...
The `HiveHook` failed to establish a connection to HiveServer2. This can be due to incorrect host/port, network issues, or an inaccessible HiveServer2.
fix
Verify the Hive connection details (host, port, schema) in the Airflow UI. Ensure HiveServer2 is running and accessible from the Airflow worker. Check firewall rules and network connectivity. Enable debug logging for `pyhive` for more detailed connection errors.
sqlalchemy.exc.DBAPIError: (pyhive.exc.OperationalError) TTransportException: GSS-API (or Kerberos) authentication failed
Kerberos authentication failed when `HiveHook` tried to connect to HiveServer2. This is often due to misconfigured keytab, principal, or client environment.
fix
Ensure the Kerberos keytab is valid and accessible, the principal matches the service principal, and the `kinit` command can successfully obtain a ticket. Verify the Hive connection in Airflow UI has 'Auth Mechanism' set to 'Kerberos' and 'Principal' and 'Keytab Path' are correct. Install `apache-airflow-providers-apache-hive[kerberos]`.
Upgrade
Version history
9.5.0latest on PyPI · released May 23, 2026
Audit
Dependencies
apache-airflowrequiredCore Apache Airflow framework is required for all providers.
pyhiveoptionalRequired for `HiveHook` to connect to HiveServer2 via Thrift. Not a direct provider dependency, but an underlying requirement for common use cases.
thrift-sasloptionalRequired for SASL authentication, often used with Kerberos for `HiveHook`.
Agent activity
41 hits · last 30 days
node
38
OpenAI (training)
1
Resources
apache-airflow-providers-apache-hive — pip install apache-airflow-providers-apache-hive · libregistry