- redis-py version: 7.1.0
- Redis servers running:
- Port 6379 (primary)
- Port 6380 (secondary)
- pybreaker: Installed (required for multidb)
All multidb tests passed successfully:
✅ test_multidb_available passed
✅ test_multidb_config_creation passed
✅ test_multidb_client_creation passed
✅ test_multidb_from_urls passed
✅ test_multidb_client_initialize passed
✅ test_event_dispatcher_support passed
✅ test_connection_creation_with_event_dispatcher passed
Test file: tests/test_multidb.py
- MultiDB Availability - Verified multidb support is available with redis-py 7.x
- Configuration Creation - Successfully created MultiDbConfig with multiple databases
- Client Creation - Created KVDBMultiDBClient from config
- from_urls Method - Created client using convenient from_urls() method
- Client Initialization - Initialized client and performed basic operations (set/get)
- Event Dispatcher Support - Verified event_dispatcher parameter in AsyncAbstractConnection
- Connection Pool Creation - Created AsyncConnectionPool without errors
Verified compatibility features:
- ✅ EventDispatcher import: Successfully imported with backward compatibility
- ✅ event_dispatcher parameter: Present in AsyncAbstractConnection.init
- ✅ DEPRECATED_SUPPORT flag: Set to False (redis-py >= 7.0 detected)
- ✅ Connection initialization: event_dispatcher initialized when not provided
- Created client with 2 databases (ports 6379 and 6380)
- Successfully initialized with health checks
- Performed SET operation
- Performed GET operation
- Verified database weights (1.0 and 0.5)
- Retrieved database list (2 databases)
- Created ConnectionPool from URL
- Created AsyncConnectionPool from URL
- Both pools initialized without errors
- ✅ Imported EventDispatcher from redis.asyncio.connection
- ✅ Added event_dispatcher parameter to AsyncAbstractConnection
- ✅ Graceful fallback for older redis-py versions
- ✅ Auto-initialization of event_dispatcher when None
- ✅ KVDBMultiDBClient wrapper created
- ✅ from_urls() convenience method working
- ✅ Configuration with DatabaseConfig working
- ✅ Client initialization with health checks working
- ✅ Basic Redis operations (set/get) working
- ✅ Multiple database support verified
- ✅ MULTIDB_AVAILABLE flag working correctly
- ✅ DEPRECATED_SUPPORT flag for version detection
- ✅ Graceful handling of missing EventDispatcher
- ✅ Graceful handling of missing pybreaker
- ✅
docs/multidb.md- Comprehensive documentation created - ✅
examples/multidb_example.py- Working example created - ✅
README.md- Updated with multidb features
✅ All redis-py 7.x compatibility tests PASSED ✅ Multi-database (Active-Active) support fully functional ✅ Event dispatcher parameter properly integrated ✅ Backward compatibility maintained ✅ Documentation complete
-
The multidb features require:
- redis-py >= 7.0
- pybreaker (for circuit breakers)
-
The implementation gracefully handles missing dependencies with MULTIDB_AVAILABLE flag
-
The redis.multidb module shows a UserWarning about being experimental, which is expected behavior from redis-py
-
All changes maintain backward compatibility with redis-py >= 5.0
The implementation successfully adds redis-py 7.x support with full Active-Active multi-database functionality. All tests pass and the features work as documented.