You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The project includes comprehensive examples demonstrating various features and use cases. Each example can be run using the provided Makefile, which automatically handles Cassandra setup if needed.
293
+
294
+
### Available Examples
295
+
296
+
Run any example with: `make example-<name>`
297
+
298
+
-**`make example-basic`** - Basic connection and query execution
299
+
-**`make example-streaming`** - Memory-efficient streaming of large result sets with True Async Paging
-**`make example-export-large-table`** - Export large tables to CSV with progress tracking
302
+
-**`make example-export-parquet`** - Export data to Parquet format with complex data types
303
+
-**`make example-metrics`** - Comprehensive metrics collection and performance monitoring
304
+
-**`make example-metrics-simple`** - Basic metrics collection example
305
+
-**`make example-realtime`** - Real-time data processing with sliding window analytics
306
+
-**`make example-streaming-demo`** - Visual demonstration that streaming doesn't block the event loop
307
+
308
+
### Running with External Cassandra
309
+
310
+
If you have Cassandra running elsewhere:
311
+
312
+
```bash
313
+
# Single node
314
+
CASSANDRA_CONTACT_POINTS=10.0.0.1 make example-streaming
315
+
316
+
# Multiple nodes
317
+
CASSANDRA_CONTACT_POINTS=10.0.0.1,10.0.0.2,10.0.0.3 make example-streaming
318
+
319
+
# With custom port
320
+
CASSANDRA_CONTACT_POINTS=cassandra.example.com CASSANDRA_PORT=9043 make example-basic
321
+
```
322
+
323
+
### Example Descriptions
324
+
325
+
-**Basic Example**: Shows fundamental operations like connecting, executing queries, and using prepared statements
326
+
-**Streaming Examples**: Demonstrate True Async Paging for processing millions of rows without memory issues
327
+
-**Export Examples**: Show how to export Cassandra data to various formats (CSV, Parquet) with progress tracking
328
+
-**Metrics Examples**: Illustrate performance monitoring, query tracking, and connection health checking
329
+
-**Real-time Processing**: Demonstrates processing time-series IoT data with concurrent operations
330
+
-**Context Safety Demo**: Proves that errors in one operation don't affect others when using context managers
331
+
332
+
Each example includes detailed comments explaining the concepts and best practices. Start with `example-basic` if you're new to the library.
333
+
290
334
## ⚡ Performance
291
335
292
336
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.
0 commit comments