This is an example implementation of a SQL execution review workflow using Humancheck. This demonstrates how to integrate human review for database operations, but Humancheck can be used for any system operation that requires human approval.Documentation Index
Fetch the complete documentation index at: https://docs.humancheck.dev/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The SQL execution review workflow:- Agent generates SQL query
- System analyzes query for risk (destructive operations, data scope, etc.)
- If risky, request human review
- Reviewer approves, rejects, or modifies query
- System executes approved query
Implementation
Basic SQL Execution Review
Advanced Features
Query Validation
Read-Only Mode
Transaction Support
Routing Rules
Route SQL reviews to database administrators:Dashboard Integration
The SQL execution request appears in the dashboard with:- SQL query (with syntax highlighting)
- Database name
- Risk level and score
- Risk factors identified
- Estimated affected rows
- Query type (SELECT, DELETE, UPDATE, etc.)
- ✅ Approve query for execution
- ❌ Reject with reason
- ✏️ Modify query (add WHERE clause, LIMIT, etc.) before approving
Best Practices
- Always review destructive operations: DELETE, DROP, TRUNCATE should always require review
- Check for WHERE clauses: Queries without WHERE clauses are dangerous
- Add LIMIT clauses: Encourage LIMIT clauses for safety
- Provide context: Show why the query is needed
- Use read-only mode: For SELECT queries, use read-only database connections
- Log all executions: Maintain audit trail of all SQL executions
- Test queries first: Use EXPLAIN or similar to show query plan
Security Considerations
- Principle of least privilege: Use database users with minimal permissions
- Parameterized queries: Always use parameterized queries to prevent SQL injection
- Query timeouts: Set timeouts to prevent long-running queries
- Connection limits: Limit number of concurrent connections
- Backup before destructive ops: Consider requiring backups before destructive operations
Next Steps
- Learn about Payment Approval workflows
- Explore Routing Rules for automatic assignment
- Check out Connectors for Slack notifications