Track 07 · Data & governanceLesson 03 of 11

Agents over tables: text-to-SQL and beyond

Answer questions from structured data, safely and verifiably.

What you'll be able to do

What you'll be able to do

01
  • You can choose between free-form text-to-SQL, a semantic layer and parameterised query tools for a given question set and risk level.
  • You can design schema-linking context: descriptions, join paths, sample values and verified queries.
  • You can implement a guarded executor: read-only identity, SELECT-only validation, table allow-list, row caps, timeouts and row-level security.
  • You can build an execution-accuracy eval and explain why result equivalence, not string match, is the metric.
  • You can design self-correction, clarification and provenance so a wrong number is caught before it reaches a decision.
  • You can defend the design to a sceptical CISO and a protective data-platform owner.
Before you start

Before you start

The short version

The short version

An agent answering from tables can write SQL freely (text-to-SQL), compose queries from a curated vocabulary of metrics and dimensions (a semantic layer), or call reviewed parameterised queries as tools. They trade flexibility for control, and production systems mix them. Whatever writes the SQL, a deterministic executor enforces the rules: read-only identity, parser-based SELECT-only validation, a table allow-list, row and time limits, and row-level security in the warehouse. You measure it by executing generated and gold SQL and comparing results, never SQL strings. Every answer ships with provenance: SQL, tables, definitions and as-of time.

  • Business definitions ("booked", "on time") are where answers go wrong. A semantic layer is where they live.
  • Security belongs in the database; application checks are a second layer. A regex is not a boundary.
  • Execution accuracy on your own golden set is the number that matters.
  • Retry repairable errors. Never retry policy violations.

Pro lesson

The rest of this lesson is in Pro.

The mental model, worked example, field note, failure table, exercise and self-check, with the voice tutor.

Pro opens this stage

Stage 3 · Answers from their data
  • 4 lessons, with the voice tutor

Also in Pro

  • Every stage and specialisation, in full
  • Every lab and every role project
  • Halden weeks 2–10, on your record
  • Every drill, live in the playground
  • All solutions, plus the server judge
  • Lab Assistant and every Teach with AI