Implement Vector Search with sqlite-vec Extension#1
Merged
renecannao merged 6 commits intov3.0-vecfrom Dec 24, 2025
Merged
Conversation
This commit integrates sqlite-vec (https://github.com/asg017/sqlite-vec) as a statically linked extension, enabling vector search capabilities in all ProxySQL SQLite databases (admin, stats, config, monitor). Changes: 1. Added sqlite-vec source files to deps/sqlite3/sqlite-vec-source/ - sqlite-vec.c: main extension source - sqlite-vec.h: header for static linking - sqlite-vec.h.tmpl: template header 2. Modified deps/Makefile: - Added target sqlite3/sqlite3/vec.o that copies sources and compiles with flags -DSQLITE_CORE -DSQLITE_VEC_STATIC - Made sqlite3 target depend on vec.o 3. Modified lib/Makefile: - Added $(SQLITE3_LDIR)/vec.o to libproxysql.a prerequisites - Included vec.o in the static library archive 4. Modified lib/Admin_Bootstrap.cpp: - Added extern "C" declaration for sqlite3_vec_init - Enabled load extension support for all databases: - admindb, statsdb, configdb, monitordb, statsdb_disk - Registered sqlite3_vec_init as auto-extension at database open (replacing commented sqlite3_json_init) 5. Updated top-level Makefile: - Made GIT_VERSION fallback to git describe --always when tags missing Result: - Vector search functions (vec0 virtual tables, vector operations) are available in all ProxySQL SQLite databases without runtime dependencies - No separate shared library required; fully embedded in proxysql binary - Extension automatically loaded at database initialization
This commit adds extensive documentation for the sqlite-vec vector search extension integration in ProxySQL, including: ## README Documentation ### deps/sqlite3/README.md - Overview of sqlite-vec and its vector search capabilities - Integration method using static linking - Directory structure explanation - Compilation flags and build process details - Usage examples for all ProxySQL databases - Benefits and verification instructions ### deps/sqlite3/sqlite-vec-source/README.md - Complete sqlite-vec documentation - Source files explanation - Integration specifics for ProxySQL - Licensing information - Standalone building instructions - Performance considerations ## Doxygen Code Documentation ### lib/Admin_Bootstrap.cpp - Added comprehensive doxygen comments for sqlite-vec integration - Documented sqlite3_vec_init function declaration - Added section documentation for SQLite database initialization - Detailed documentation for each database instance: * Admin: Configuration analytics and vector operations * Stats: Performance metrics and similarity analysis * Config: Configuration optimization with vectors * Monitor: Anomaly detection and pattern recognition * Stats Disk: Historical trend analysis - Included usage examples and cross-references - Explained auto-extension mechanism and integration benefits The documentation provides developers with a complete reference for understanding, using, and maintaining the sqlite-vec integration in ProxySQL's SQLite databases. Technical Details: - Static linking implementation - Virtual table mechanism - JSON vector format support - Auto-extension registration - Multi-database integration - Performance optimizations
- Clear distinction between Admin Interface (port 6032) and SQLite3 Server (port 6030) - Explanation of MySQL-to-SQLite gateway functionality - Simple usage examples and common operations - Vector search integration with sqlite-vec - Correct authentication using mysql_users table - Removed incorrect assumptions about non-existent configuration options
- Complete step-by-step testing procedures for ProxySQL SQLite3 server vector search - Includes connectivity testing, vector table creation, data insertion, and similarity search - Provides practical use case examples (product recommendations, user sessions) - Includes performance testing and error handling scenarios - Contains Python vector generator and shell test scripts - Detailed troubleshooting section and expected results - Suitable for both ProxySQL developers and users - Enables reproducible testing of sqlite-vec integration File: doc/Vector-Search-Testing-Guide.md (9,718 lines)
Create comprehensive testing guide for ProxySQL vector search capabilities: - Separate test scripts for connectivity, table creation, data insertion, and similarity search - Simplified README.md referencing external script files - Modular structure for easy maintenance and extension - Proper error handling and result tracking - Executable scripts with consistent testing patterns Removes previous inline documentation approach in favor of maintainable file structure.
The previous approach of embedding scripts inline in a large Markdown file has been replaced with a modular file structure for better maintainability. - Removed doc/Vector-Search-Testing-Guide.md (9,718 lines with inline scripts) - Modular approach now uses separate executable scripts in doc/vector-search-test/ - Better separation of concerns and easier script maintenance
renecannao
added a commit
that referenced
this pull request
Jan 16, 2026
Add comprehensive error details to help users debug NL2SQL conversion issues. Changes: - Add error_code, error_details, http_status_code, provider_used fields to NL2SQLResult - Add NL2SQLErrorCode enum with structured error codes: * SUCCESS, ERR_API_KEY_MISSING, ERR_API_KEY_INVALID, ERR_TIMEOUT * ERR_CONNECTION_FAILED, ERR_RATE_LIMITED, ERR_SERVER_ERROR * ERR_EMPTY_RESPONSE, ERR_INVALID_RESPONSE, ERR_SQL_INJECTION_DETECTED * ERR_VALIDATION_FAILED, ERR_UNKNOWN_PROVIDER, ERR_REQUEST_TOO_LARGE - Add nl2sql_error_code_to_string() function for error code conversion - Add format_error_context() helper to create detailed error messages including: * Query (truncated if too long) * Schema name * Provider attempted * Endpoint URL * Specific error message - Add set_error_details() helper to populate error fields - Update error handling in convert() to use new error details - Track provider_used in successful conversions This provides much better debugging information when NL2SQL conversions fail, making it easier to identify misconfigurations and connectivity issues. Fixes #1 - Improve Error Messages
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.
Summary
This PR implements comprehensive vector search capabilities in ProxySQL by integrating the sqlite-vec extension.
Changes
sqlite-vec Integration
Build System Updates
Core Integration
Testing Framework
Documentation
Technical Implementation
Vector Search Support
Example Usage
Files Added
Files Modified
Testing
The implementation includes comprehensive testing:
Impact
This enables ProxySQL to support:
Security
Performance