v0.3.0 - SQLite Database Operations Module
v0.3.0 - SQLite Database Operations Module
Add comprehensive SQLite database module with 16 functions for safe database operations, schema management, and data migration.
ποΈ New Module: Database (16 functions)
Database Operations (5 functions)
create_sqlite_database: Create new SQLite database with parent directory creationexecute_query: Execute INSERT/UPDATE/DELETE with parameterized queriesexecute_many: Batch execution in single transactionfetch_all: Return all rows as dictionaries with column namesfetch_one: Return single row with found indicator
Schema Management (4 functions)
inspect_schema: Complete schema info (tables, columns, types, indexes, row counts)create_table_from_dict: Create table from column nameβtype mappingadd_column: Add column to existing table with validationcreate_index: Create indexes with auto-name generation
Safe Query Building (6 functions)
build_select_query: Parameterized SELECT with WHERE/ORDER BY/LIMITbuild_insert_query: Parameterized INSERT with validationbuild_update_query: Parameterized UPDATE (requires WHERE clause)build_delete_query: Parameterized DELETE (requires WHERE clause)escape_sql_identifier: Validate table/column names (alphanumeric + underscore)validate_sql_query: Basic SQL injection pattern detection
Migration Helpers (3 functions)
export_to_json: Export table data to JSON with UTF-8 encodingimport_from_json: Import JSON with optional table clearingbackup_database: Full database backup preserving metadata
β¨ Key Features
- Pure stdlib implementation - Uses only
sqlite3, zero external dependencies - SQL injection prevention - Parameterized queries + identifier validation
- Google ADK compliance - JSON-serializable returns, no default parameter values
- Comprehensive error handling - TypeError, ValueError for all inputs
- Safe by default - UPDATE/DELETE require WHERE clauses to prevent accidents
π§ͺ Testing
- 81 new tests with comprehensive coverage
- Total: 532 tests passing in 4.0s (451 β 532)
- Database module coverage: operations (79%), query_builder (89%), schema (75%), utils (71%)
- Overall project coverage: 85% (maintains >80% target)
π¦ Integration
- Added
load_all_database_tools()helper function - Updated
load_all_tools()to 84 total functions (66 β 84) - Updated main
__init__.pyto export database module
π― Quality
- β 100% ruff compliance maintained
- β 100% mypy --strict compliance maintained
- β All functions have comprehensive docstrings
- β
Full type coverage with modern syntax (
dict[str, Any])
π Use Cases
- Agent memory: Persistent storage for agent state and conversation history
- Structured data: Store and query structured information efficiently
- Data migration: Export/import JSON for backup and transfer
- Safe queries: Build parameterized queries programmatically
π Documentation
- Updated CHANGELOG.md with v0.3.0 release notes
- Updated README.md "What's Available Now" section
- All 16 functions documented with Args/Returns/Raises sections
π Full Changelog
See CHANGELOG.md for complete details.
Install: pip install coding-open-agent-tools==0.3.0
Upgrade: pip install --upgrade coding-open-agent-tools
π€ Generated with Claude Code