> ## Documentation Index
> Fetch the complete documentation index at: https://agent-observability-docs.splunk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Text-to-SQL Evaluators

> Evaluate the quality, safety, and efficiency of AI-generated SQL queries using Splunk Agent Observability's Text-to-SQL evaluators

export const ModalityIcons = ({modalities}) => {
  const iconProps = {
    fill: "none",
    height: 20,
    width: 20,
    stroke: "currentColor",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    strokeWidth: 2,
    viewBox: "0 0 24 24",
    xmlns: "http://www.w3.org/2000/svg"
  };
  const renderIcon = modality => {
    if (modality === "Text") {
      return <svg {...iconProps} aria-hidden="true">
          <circle cx="12" cy="12" r="9" />
          <path d="M8 8h8M12 8v8" />
        </svg>;
    }
    if (modality === "Image/PDF") {
      return <svg {...iconProps} aria-hidden="true">
          <rect height="18" rx="2" width="18" x="3" y="3" />
          <circle cx="8.5" cy="8.5" r="1.5" />
          <path d="m21 15-5-5L5 21" />
        </svg>;
    }
    if (modality === "Audio") {
      return <svg {...iconProps} aria-hidden="true">
          <path d="M9 18V5l10-2v13" />
          <circle cx="6" cy="18" r="3" />
          <circle cx="16" cy="16" r="3" />
        </svg>;
    }
    return null;
  };
  return <span aria-label={`Supported modalities: ${modalities.join(", ")}`} role="group" style={{
    display: "inline-flex",
    alignItems: "center",
    gap: "0.5rem"
  }}>
      {modalities.map(modality => <span aria-label={modality} key={modality} role="img" style={{
    display: "inline-flex",
    flexShrink: 0
  }} title={modality}>
          {renderIcon(modality)}
        </span>)}
    </span>;
};

Text-to-SQL evaluators help you measure how well your AI systems generate SQL queries from natural language inputs. These evaluators measure multiple dimensions of SQL generation quality—from syntactic correctness to security—helping you build reliable and safe Text-to-SQL applications.

Use these evaluators when you want to:

* 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.

Below is a quick reference table of all Text-to-SQL evaluators:

| Name                                                             | Description                                                                                                 | Supported Nodes | Modalities                              | When to Use                                                                                                        | Example Use Case                                                                                            |
| :--------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------- | :-------------- | :-------------------------------------- | :----------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------- |
| [SQL Correctness](/concepts/evaluators/text2sql/sql-correctness) | Evaluates whether a generated SQL query is syntactically valid and adheres to the provided database schema. | LLM span        | <ModalityIcons modalities={["Text"]} /> | 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](/concepts/evaluators/text2sql/sql-adherence)     | Evaluates whether a generated SQL query semantically aligns with the user's natural language intent.        | LLM span        | <ModalityIcons modalities={["Text"]} /> | 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](/concepts/evaluators/text2sql/sql-injection)     | Detects SQL injection attacks and security vulnerabilities in generated SQL queries.                        | LLM span        | <ModalityIcons modalities={["Text"]} /> | 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](/concepts/evaluators/text2sql/sql-efficiency)   | Evaluates whether a generated SQL query is structured efficiently and avoids performance anti-patterns.     | LLM span        | <ModalityIcons modalities={["Text"]} /> | 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.                |

***

## Next steps

* [Back to Evaluators Overview](/concepts/evaluators/overview)
* [Compare all evaluators](/concepts/evaluators/evaluator-comparison)
