feat: Major CafeDB enhancement - production-ready with advanced features#1
Open
shubhayu-dev wants to merge 1 commit intoCrystallineCore:mainfrom
Open
feat: Major CafeDB enhancement - production-ready with advanced features#1shubhayu-dev wants to merge 1 commit intoCrystallineCore:mainfrom
shubhayu-dev wants to merge 1 commit intoCrystallineCore:mainfrom
Conversation
BREAKING CHANGES: - Custom exceptions replace generic ValueError (TableNotFoundError, TableExistsError, QueryError) - Automatic metadata injection (_inserted_at, _updated_at timestamps) NEW FEATURES: - Thread-safe operations with RLock for concurrent access - Transaction context manager with automatic rollback on errors - Batch insert via insert_many() for efficient bulk operations - Advanced select() with sorting (order_by, reverse), pagination (limit, offset), and field projection - Automatic backup creation (.backup file) before writes (configurable) - New clear_table() to empty tables without dropping - New info() method for database-wide metadata and statistics - Enhanced stats() with field percentages, min/max/avg for numeric fields, and size estimation - Support for operator to check field presence IMPROVEMENTS: - Atomic writes with crash-safe temp file mechanism - Conditional writes (only write if data changed) in update/delete - Unicode support with ensure_ascii=False in JSON serialization - Table name validation (no underscore prefix - reserved for internal) - Alphabetically sorted table lists - Comprehensive error messages with helpful suggestions and available options - Type validation on all inputs with descriptive error messages - Better operator validation with full list of valid operators in errors - Graceful handling of type mismatches in comparisons - Version tracking in metadata DOCUMENTATION: - Comprehensive docstrings for all public methods - Type hints throughout - Detailed parameter descriptions and return values - Examples in docstrings PERFORMANCE: - Single write per insert_many() vs N writes for N inserts - Skip disk writes when no rows affected in update/delete - Efficient sorting with fallback for mixed types This update transforms CafeDB from a simple prototype into a production-ready database suitable for small to medium applications with proper error handling, thread safety, audit trails, and data protection mechanisms.
Author
Quick Overview of Changes by FunctionCore Infrastructure
New Functions
CRUD Operations
Introspection
Summary in 3 Points:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BREAKING CHANGES:
NEW FEATURES:
IMPROVEMENTS:
DOCUMENTATION:
PERFORMANCE:
This update transforms CafeDB from a simple prototype into a production-ready database suitable for small to medium applications with proper error handling, thread safety, audit trails, and data protection mechanisms.