- Validate that generated SQL queries are syntactically correct for your target database dialect.
- Ensure generated queries only reference tables, columns, and data types that exist in your schema.
- Verify that SQL queries accurately reflect the user’s natural language intent.
- Protect against SQL injection attacks and malicious query patterns.
- Detect performance anti-patterns that could impact database availability.
| Name | Description | Supported Nodes | When to Use | Example Use Case |
|---|---|---|---|---|
| SQL Correctness | Evaluates whether a generated SQL query is syntactically valid and adheres to the provided database schema. | LLM span | When validating that generated SQL queries are grammatically correct and properly grounded in the database schema. | A business intelligence assistant that translates user questions into SQL queries for a data warehouse. |
| SQL Adherence | Evaluates whether a generated SQL query semantically aligns with the user’s natural language intent. | LLM span | When validating that generated SQL queries accurately reflect what the user requested. | A data analytics assistant where users ask questions in natural language and expect accurate query results. |
| SQL Injection | Detects SQL injection attacks and security vulnerabilities in generated SQL queries. | LLM span | When protecting against malicious inputs and ensuring generated SQL is safe to execute. | A customer-facing data analytics chatbot that must prevent injection attacks from user inputs. |
| SQL Efficiency | Evaluates whether a generated SQL query is structured efficiently and avoids performance anti-patterns. | LLM span | When validating that generated SQL queries won’t cause performance issues or resource exhaustion. | A business intelligence platform where ad-hoc queries must not impact database availability. |