A Python library designed to make the Python Cassandra© driver compatible with modern async frameworks
Repo axonops/async-python-cassandra-client, read from GitHub 1 min ago. axonops has not joined Take My Repo.
axonops/async-python-cassandra-client is a public repo on GitHub by axonops. A Python library designed to make the Python Cassandra© driver compatible with modern async frameworks. It declares the Apache-2.0 license on GitHub. It is written mainly in Python, has 7 stars and last changed on 2025-07-15. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-22.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
📢 Early Release: This is an early release of async-cassandra. While it has been tested extensively, you may encounter edge cases. We welcome your feedback and contributions! Please report any issues on our GitHub Issues page.
This is a monorepo containing two related Python packages:
async-cassandra is a Python library that enables the Cassandra driver to work seamlessly with async frameworks like FastAPI, aiohttp, and Quart. It provides an async/await interface that prevents blocking your application's event loop while maintaining full compatibility with the DataStax Python driver.
When using the standard Cassandra driver in async applications, blocking operations can freeze your entire service. This wrapper solves that critical issue by bridging the gap between Cassandra's thread-based I/O and Python's async ecosystem, ensuring your web services remain responsive under load.
In async Python applications, an event loop manages all operations in a single thread. Think of it like a smart traffic controller - it efficiently switches between tasks whenever one is waiting for I/O (like a database query). This allows handling thousands of concurrent requests without creating thousands of threads.
The key issue: When you use the standard Cassandra driver (which is synchronous) inside an async web framework like FastAPI or aiohttp, you create a blocking problem. The synchronous driver operations block the event loop, preventing your async application from handling other requests.
Important clarification: This blocking issue only occurs when:
If you're building a traditional synchronous application (Flask, Django without async views), the standard Cassandra driver works fine and you don't need this wrapper.
Here's a concrete example showing the problem and solution:
# ❌ Synchronous code in an async handler - BLOCKS the event loop from fastapi import FastAPI from cassandra.cluster import Cluster app = FastAPI() cluster = Cluster(['localhost']) session = cluster.connect() @app.get("/users/{user_id}") async def get_user(user_id: str): # This blocks the event loop! While this query runs, # your FastAPI app cannot process ANY other requests result = session.execute("SELECT * FROM users WHERE id = %s", [user_id]) return {"user": result.one()}
# ✅ Async code with our wrapper - NON-BLOCKING from contextlib import asynccontextmanager from fastapi import FastAPI from async_cassandra import AsyncCluster session = None user_stmt = None @asynccontextmanager async def lifespan(app: FastAPI): global session, user_stmt # Use context managers for proper resource management async with AsyncCluster(['localhost']) as cluster: async with cluster.connect() as session: # Prepare statement for better performance user_stmt = await session.prepare( "SELECT * FROM users WHERE id = ?" ) yield # App runs here # Cleanup happens automatically app = FastAPI(lifespan=lifespan) @app.get("/users/{user_id}") async def get_user(user_id: str): # This doesn't block! The event loop remains free to handle # other requests while waiting for the database response result = await session.execute(user_stmt, [user_id]) return {"user": result.one()}
The key difference: with the sync driver, each database query blocks your entire async application from handling other requests. With async-cassandra, the event loop remains free to process other work while waiting for database responses.
This library provides true async/await support, enabling:
See our Architecture Overview for technical details, or learn more about What This Wrapper Actually Solves (And What It Doesn't).
The standard Cassandra driver's manual paging (fetch_next_page()) is synchronous, which blocks your entire async application:
# ❌ With standard driver - blocks the event loop result = await session.execute("SELECT * FROM large_table") while result.has_more_pages: result.fetch_next_page() # This blocks! Your app freezes here # ✅ With async-cassandra streaming - truly async result = await session.execute_stream("SELECT * FROM large_table") async for row in result: await process_row(row) # Non-blocking, other requests keep flowing
This is critical for web applications where blocking the event loop means all other requests stop being processed. For a detailed explanation of this issue, see our streaming documentation.
This wrapper makes the cassandra-driver compatible with async Python applications, but it's important to understand what it does and doesn't do:
What it DOES:
What it DOESN'T do:
The cassandra-driver uses blocking sockets and thread pools internally. This wrapper provides a compatibility layer but cannot change the fundamental architecture. For a detailed technical analysis, see our Why Async Wrapper documentation.
Several other async Cassandra drivers exist for Python, each with different design approaches:
See our comparison guide for technical differences between these libraries.
async-cassandra requires CQL protocol v5 or higher for all connections. We verify this requirement after connection to ensure you get the best available protocol version.
# Recommended: Let driver negotiate to highest available cluster = AsyncCluster(['localhost']) # Negotiates to highest (currently v5) await cluster.connect() # Fails if negotiated < v5 # Explicit versions (v5+): cluster = AsyncCluster(['localhost'], protocol_version=5) # Forces v5 exactly # This raises ConfigurationError immediately: cluster = AsyncCluster(['localhost'], protocol_version=4) # ❌ Not supported
Why We Enforce v5+ (and not v4 or older):
Async Performance: Protocol v5 introduced features that significantly improve async operations:
Testing & Maintenance: Supporting older protocols would require:
Security & Features: Older protocols lack:
Industry Standards:
What This Means for You:
When connecting:
ConnectionError: Connected with protocol v4 but v5+ is required.
Your Cassandra server only supports up to protocol v4.
async-cassandra requires CQL protocol v5 or higher (Cassandra 4.0+).
Please upgrade your Cassandra cluster to version 4.0 or newer.
Upgrade Options:
We understand this requirement may be inconvenient for some users, but it allows us to provide a better, more maintainable async experience while focusing our testing and development efforts on modern Cassandra deployments.
# From PyPI pip install async-cassandra # From source (for development) cd libs/async-cassandra pip install -e .
🚧 In Active Development: async-cassandra-bulk is currently under development and not yet available on PyPI. It will provide high-performance bulk operations for async-cassandra.
import asyncio from async_cassandra import AsyncCluster async def main(): # Connect to Cassandra cluster = AsyncCluster(['localhost']) session = await cluster.connect() # Execute queries result = await session.execute("SELECT * FROM system.local") print(f"Connected to: {result.one().cluster_name}") # Clean up await session.close() await cluster.shutdown() if __name__ == "__main__": asyncio.run(main())
For more detailed examples, see our Getting Started Guide.
We welcome contributions! Please see:
Important: All contributors must sign our Contributor License Agreement (CLA) before their pull request can be merged.
The async-cassandra library includes comprehensive examples demonstrating various features and use cases. Examples are located in the libs/async-cassandra/examples/ directory.
First, navigate to the async-cassandra directory:
cd libs/async-cassandraThen run any example with: make example-<name>
make example-basic - Basic connection and query executionmake example-streaming - Memory-efficient streaming of large result sets with True Async Pagingmake example-context-safety - Demonstrates proper context manager usage and resource isolationmake example-export-large-table - Export large tables to CSV with progress trackingmake example-export-parquet - Export data to Parquet format with complex data typesmake example-metrics - Comprehensive metrics collection and performance monitoringmake example-metrics-simple - Basic metrics collection examplemake example-realtime - Real-time data processing with sliding window analyticsmake example-streaming-demo - Visual demonstration that streaming doesn't block the event loopIf you have Cassandra running elsewhere:
# From the libs/async-cassandra directory: cd libs/async-cassandra # Single node CASSANDRA_CONTACT_POINTS=10.0.0.1 make example-streaming # Multiple nodes CASSANDRA_CONTACT_POINTS=10.0.0.1,10.0.0.2,10.0.0.3 make example-streaming # With custom port CASSANDRA_CONTACT_POINTS=cassandra.example.com CASSANDRA_PORT=9043 make example-basic
Each example includes detailed comments explaining the concepts and best practices. Start with example-basic if you're new to the library.
async-cassandra enables your async Python application to work with Cassandra without blocking the event loop. While it doesn't eliminate the underlying driver's thread pool, it prevents those blocking operations from freezing your entire application. This is crucial for web servers where a blocked event loop means no requests can be processed.
The wrapper's primary benefit is compatibility, not raw performance. It allows you to use Cassandra in async applications like FastAPI without sacrificing the responsiveness of your service.
For performance optimization tips and understanding the limitations, see our Performance Guide.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
This project may contain trademarks or logos for projects, products, or services. Any use of third-party trademarks or logos are subject to those third-party's policies.
Important: This project is not affiliated with, endorsed by, or sponsored by the Apache Software Foundation or the Apache Cassandra project. It is an independent framework developed by AxonOps.
This project is an independent work and has not been authorized, sponsored, or otherwise approved by the Apache Software Foundation.
This project uses the Apache License 2.0, which is compatible with the Apache Cassandra project. We acknowledge and respect all applicable licenses of dependencies used in this project.
Made with ❤️ by the AxonOps Team
axonops/async-python-cassandra-client is a public repo on GitHub by axonops. A Python library designed to make the Python Cassandra© driver compatible with modern async frameworks.
It declares the Apache-2.0 license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2025-07-15. GitHub counts 1 open issue and pull requests. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
:house_with_garden: Open source home automation that puts local control and privacy first.
Few projects related to Data Engineering including Data Modeling, Infrastructure setup on cloud, Data Warehousing and Data Lake development.
FastAPI framework, high performance, easy to learn, fast to code, ready for production
💥 Blazing fast terminal file manager written in Rust, based on async I/O.
AxonOps® Workbench for Apache Cassandra® - Desktop application for Mac, Windows and Linux
Modern AI-powered CQL shell for Apache Cassandra® with rich terminal UI, cqlsh compatibility, and natural language query generation
High-performance, API-compatible drop-in replacement for Confluent Schema Registry. Avro, Protobuf & JSON Schema with PostgreSQL, MySQL, Cassandra storage. Built-in RBAC, client side field encryption, data contracts, audit logging. No Kafka dependency. Apache 2.0.

Comprehensive cluster analysis tool for Apache Cassandra® powered by AxonOps. Analyzes configuration, performance, security, and data model to provide actionable recommendations.

Collection of Ansible roles to install and configure AxonOps® and its components
This page is also available as structured data, with the same sources and dates.
/api/v1/resources/gh/axonops/async-python-cassandra-clientTake My Repo has not tested this on your machine. Requirements come from the project's own documentation.