A high-performance Rust reimplementation of the TinyDB library, providing memory safety and improved performance while maintaining API compatibility with the original Python implementation.
This project is in Beta and ready for use. All core TinyDB functionality is implemented.
- Complete TinyDB API: 100% API compatible with the original TinyDB library
- High Performance: Core operations implemented in Rust, providing better performance than pure Python
- Storage Backends:
JSONStorage: Persistent JSON file storageMemoryStorage: In-memory storage for testing
- Query System: Full query API with support for complex conditions (==, !=, <, <=, >, >=, matches, search, test, exists, etc.)
- Table Operations: Complete CRUD operations (insert, search, update, remove, all, get, contains, count, etc.)
- Middleware Support: CachingMiddleware and other middleware support
- Utilities: LRUCache, FrozenDict, freeze() function
- Performance Optimizations:
- Rust-side table caching to reduce Python-Rust conversions
- Fast-path query evaluation for Rust Query objects
- Optimized document matching and filtering
pip install tinydb-rust- Python >= 3.8
Benchmark results demonstrate that tinydb-rust delivers improved performance compared to the pure Python TinyDB:
- Search operations: ~11% faster - Query operations show significant improvement
- Full table scans: ~6% faster - Efficient document matching and filtering
- Overall operations: ~10% faster - Balanced performance across all operations
- Memory efficient: Rust-side caching reduces Python-Rust conversion overhead
This project is licensed under the MIT License - see the LICENSE file for details.
- TinyDB - The original Python implementation
morninghao (morning.haoo@gmail.com)