SQLite Plugin
Author: langgenius
Version: 0.0.1
Type: Dify Plugin Tool
Description
A universal SQLite database tool for AI agents to query, manage, and analyze databases. Supports both SQL and JSON-based actions for easy, safe, and flexible data operations. Works with local files, cloud databases, and in-memory databases.
Features
- Universal Connection: Connect to any SQLite database via file path
- Dual Interface: Support for both SQL statements and JSON-based operations
- Comprehensive Operations:
- Create and drop tables
- Insert single or multiple rows
- Update rows with conditions
- Delete rows or entire tables
- Advanced SELECT queries (aggregates, window functions, recursive CTEs)
- Multi-language Support: English, Chinese (Simplified/Traditional), Japanese, Portuguese
- Security: Parameterized queries to prevent SQL injection
- Error Handling: Friendly error messages and detailed result reporting
- Flexible Output: Results available in both text and JSON formats
Configuration
- Database File Path: The absolute or relative path to your SQLite file
- Access Requirements: The database file must be accessible from the plugin environment
- Permissions: The plugin requires read/write access to the database file
Available Tools
1. Create Table
Creates a new table in the SQLite database using SQL CREATE TABLE statements.
Parameters:
- (required): SQL CREATE TABLE statement
Example:
2. Select Rows
Executes SQL SELECT statements to query data from tables.
Parameters:
- (required): SQL SELECT statement
Examples:
3. Insert Rows (SQL)
Inserts data using SQL INSERT statements.
Parameters:
- (required): SQL INSERT statement
Examples:
4. Insert Rows (JSON)
Inserts data using JSON format for easier programmatic access.
Parameters:
- (required): Name of the table to insert into
- (required): JSON string of data to insert (single object or array of objects)
Examples:
Single row:
Multiple rows:
5. Update Rows (SQL)
Updates data using SQL UPDATE statements.
Parameters:
- (required): SQL UPDATE statement
Example:
6. Update Rows (JSON)
Updates data using JSON format with separate data and condition parameters.
Parameters:
- (required): Name of the table to update
- (required): JSON string with columns and new values
- (required): JSON string with conditions for selecting rows to update
Example:
7. Delete Rows or Tables
Deletes rows or entire tables using SQL DELETE or DROP statements.
Parameters:
- (required): SQL DELETE or DROP statement
Examples:
Delete specific rows:
Delete all rows:
Drop entire table:
Advanced Usage Examples
Complex Queries
Window Functions
Recursive CTEs
Error Handling
The plugin provides detailed error messages for common issues:
- Invalid SQL syntax
- Table/column not found
- Constraint violations
- File access permissions
- Database corruption
Security Considerations
- All SQL operations use parameterized queries to prevent SQL injection
- Input validation is performed on all parameters
- Database file path is validated for security
- Error messages are sanitized to prevent information leakage
Performance Tips
- Use appropriate indexes for frequently queried columns
- Batch insert operations when inserting multiple rows
- Use transactions for multiple related operations
- Consider using JSON operations for simpler data structures
- Use specific column names in SELECT statements rather than
Support
For issues, questions, or contributions, please refer to the Dify plugin documentation or contact the development team.