Atlas · skill

Text-to-SQL

Text-to-SQL translates a natural-language question into a database query using schema information and the meaning of the request. The practitioner must connect language interpretation to tables, joins, filters and aggregation, then verify that the query answers the intended question within the user's data permissions.

conceptAgent Applications

What it is

A system conditions a language model on relevant schema descriptions, relationships and sometimes example queries. It generates SQL directly or uses an agent loop to inspect tables, check syntax and revise errors. Execution feedback can resolve invalid identifiers but cannot by itself determine the correct business meaning. The phrase 'active customer', for example, may require a definition absent from column names. Text-to-SQL is different from summarizing a supplied table: it creates an executable selection over a larger database. The database engine evaluates the query, while the application remains responsible for authorization, workload limits and interpretation of the returned rows.

What the work involves

The practitioner curates schema context and business definitions, restricts the accessible database objects and validates the generated query before execution. Read-only credentials, statement restrictions and row or time limits reduce unintended effects. Evaluation uses questions with expected results, especially joins, date boundaries and ambiguous measures. A useful deliverable includes the query, relevant assumptions and an answer tied to the returned data. Clarification is preferable when two plausible business definitions would produce materially different results.

Illustrative example

A sales manager asks for revenue by customer region during the previous quarter. The system identifies invoices, customer locations and currency fields, then asks whether revenue means issued or paid invoices. After the choice, it generates an aggregation with explicit quarter boundaries and inspects the result. A reviewer checks that the join does not multiply invoice lines and that the totals reconcile with a known reporting query before enabling the question for routine use.

Limits and common mistakes

Syntactically valid SQL can produce plausible but incorrect numbers through duplicate joins, missing filters or mistaken date semantics. Schema changes can invalidate otherwise successful prompts. Passing a syntax checker does not establish safe access or correct meaning. Generated queries should be tested against representative business questions and inspected for expensive scans. The skill includes recognizing when the database lacks the requested information; a model should not invent a column or infer unavailable attributes from unrelated fields.

Prerequisites

  • Text-to-SQL bots are agents with SQL tools — agent architecture is the foundation

  • hardSQL

    The agent generates SQL — it must be evaluated and debugged by someone who understands SQL deeply

Related skills

Sources and further reading

Last updated: 2026-10-10