Apache Airflow Provider for Apache Cassandra
raw JSON → 3.9.4 verified Mon Apr 27 auth: no python
An Apache Airflow provider package that enables integration with Apache Cassandra, including hooks and operators to interact with Cassandra databases. Current version 3.9.4, released April 2026. Part of the Airflow providers ecosystem with monthly releases following Airflow's release cycle.
pip install apache-airflow-providers-apache-cassandra Common errors
error ModuleNotFoundError: No module named 'airflow.providers.apache.cassandra' ↓
cause Provider package not installed.
fix
Run: pip install apache-airflow-providers-apache-cassandra
error cassandra.cluster.NoHostAvailable: ('Unable to connect to any servers', {'127.0.0.1:9042': 'Connection refused'}) ↓
cause Cassandra server is not running or connection details are incorrect.
fix
Start Cassandra server and verify host/port in Airflow connection 'cassandra_default'.
error AttributeError: module 'airflow.hooks.cassandra_hook' has no attribute 'CassandraHook' ↓
cause Using old import path from earlier Airflow versions.
fix
Change import to: from airflow.providers.apache.cassandra.hooks.cassandra import CassandraHook
Warnings
breaking In version 3.0.0, the module paths changed from `airflow.contrib.hooks.cassandra_hook` to `airflow.providers.apache.cassandra.hooks.cassandra`. Existing DAGs using the old import will break. ↓
fix Update imports to use the new provider path.
deprecated Several operators like `CassandraTableRecordOperator` are deprecated in favor of plain Python operators with hooks. Check the changelog for details. ↓
fix Use `CassandraHook` directly within a PythonOperator.
gotcha Cassandra connection requires specifying `cluster` and `keyspace` in the Airflow connection UI or via environment variables. Missing these leads to cryptic errors. ↓
fix Ensure the connection is configured with proper host, port, keyspace, and optionally extra parameters.
gotcha The `cassandra-driver` library must be installed separately; it is not included automatically with the provider. Running without it causes ModuleNotFoundError. ↓
fix Install cassandra-driver: pip install cassandra-driver
breaking Starting with provider version 2.0.0, Python 3.6 support was dropped. Users on older Python must upgrade. ↓
fix Upgrade to Python 3.7+ or stick with an older provider version.
Imports
- CassandraHook wrong
from airflow.hooks.cassandra_hook import CassandraHookcorrectfrom airflow.providers.apache.cassandra.hooks.cassandra import CassandraHook - CassandraTableRecordOperator wrong
from airflow.operators.cassandra_operator import CassandraTableRecordOperatorcorrectfrom airflow.providers.apache.cassandra.operators.cassandra import CassandraTableRecordOperator
Quickstart
from airflow import DAG
from airflow.providers.apache.cassandra.hooks.cassandra import CassandraHook
from datetime import datetime
with DAG('cassandra_test', start_date=datetime(2024,1,1), schedule=None, catchup=False) as dag:
def test_hook():
hook = CassandraHook(cassandra_conn_id='cassandra_default')
session = hook.get_conn()
rows = session.execute('SELECT * FROM system.peers')
return list(rows)
print(test_hook())