INTERMEDIATE · 8 MODULES · 64 LESSONS

SQL for LLMs and Agents

Let an AI agent answer questions about your database by writing SQL, without risking deletes or leaks, and validating each query before it runs.

For you if
You already know SQL and want a model to generate it reliably against your data.
By the end
You'll know how to give the model your schema, enforce read-only guardrails, and measure your assistant's accuracy.
You need
Intermediate SQL and Python 3.11 or later. No API key needed: model calls are simulated.
  1. 01Por qué SQL y LLMs, el problema text-to-SQL, presentado8 LESSONS
    1. Module 1 Introduction: Why SQL and LLMs
    2. The text-to-SQL problem and its promise
    3. Wrong SQL and hallucinated columns
    4. Destructive queries and injection
    5. What is a SQL agent and the `run_sql` tool
    6. The end-to-end flow
    7. Why SQL is still the interface
    8. Mini-project: your first text-to-SQL round trip
  2. 02Darle el esquema al LLM8 LESSONS
    1. Module 2 Introduction: Giving the LLM the Schema
    2. Why the LLM doesn't know your database
    3. Serializing the schema: DDL vs. compact form
    4. Column descriptions: cents and domains
    5. Sample rows in the context
    6. Extracting relationships with PRAGMA
    7. The token budget: what to include and exclude
    8. Mini-project: build a schema context for Reservo
  3. 03Promptear para SQL correcto8 LESSONS
    1. Module 3 Introduction: Prompting for Correct SQL
    2. A SQL assistant's system prompt
    3. Few-shot: question→SQL examples
    4. Pinning the SQLite dialect
    5. Constraint instructions and output format
    6. Handling ambiguity: asking for clarification or stating the assumption
    7. Asking for SQL + structured explanation
    8. Mini-project: a SQL assistant prompt for Reservo
  4. 04Validar y ejecutar el SQL generado8 LESSONS
    1. Module 4 Introduction: Validating and Executing the Generated SQL
    2. Never trust the generated SQL blindly
    3. Validating the shape: does it parse? a single statement? is it SELECT?
    4. Validating against the real schema: catching hallucinated tables and columns
    5. Executing safely: capturing errors and a sanity LIMIT
    6. The self-correction loop: feeding the error back to the model and retrying
    7. Common failure modes in generated SQL
    8. Mini-project: a validate-then-execute pipeline
  5. 05Guardrails y seguridad8 LESSONS
    1. Module 5 Introduction: Guardrails and Safety
    2. The Prompt Is Not a Security Barrier, and Least Privilege
    3. Read-Only at the Connection: `PRAGMA query_only` and `mode=ro`
    4. The Statement Allowlist: Only `SELECT`/`WITH`, a Single One
    5. Resource Limits: Forced `LIMIT`, Timeout, and Row Cap
    6. Injection: Why the LLM's SQL Is an Attack Surface, and `?` Parameters
    7. Defense in Layers: All Together, Covering Each Other
    8. Mini-Project: A Read-Only, Guarded Executor
  6. 06El loop del agente SQL8 LESSONS
    1. Module 6 Introduction: The SQL Agent Loop
    2. The Agent Loop: Question → SQL → Validate → Run → Observe → Answer
    3. Tool-Calling: the `run_sql` Contract and Its JSON Schema
    4. The `tool_use` → `tool_result` Shape of the Messages API
    5. Multi-Step: Exploring the Schema with a Tool, Then Querying
    6. When to Stop and the Iteration Cap
    7. Error Handling Inside the Loop: the Error as a `tool_result` the Model Corrects
    8. Mini-Project: a SQL Agent Loop for Reservo
  7. 07Evaluar text-to-SQL8 LESSONS
    1. Module 7 Introduction: Evaluating Text-to-SQL
    2. Why Measure and Not Trust the Impression
    3. Execution Accuracy vs. Comparing the SQL's Text
    4. Building the Test Set: Question → gold_sql
    5. The Harness That Runs the Set and Reports the %
    6. The Failure Modes the Evaluation Reveals
    7. Regression: Re-Evaluating When You Change the Prompt or the Model
    8. Mini-Project: an Evaluation Set for the Reservo Assistant
  8. 08Proyecto, un asistente SQL seguro para Reservo (capstone)8 LESSONS
    1. Module 8 Introduction: a Safe SQL Assistant for Reservo
    2. Layer 1: Assembling the Schema Context
    3. Layer 2: the System Prompt with Rules and Few-Shot
    4. Layer 3: the Validation Layer
    5. Layer 4: Guardrails and the Safe `run_sql`
    6. Layer 5: the Agent Loop with Self-Correction
    7. Layer 6: the Evaluation Set and Execution Accuracy
    8. Project: a Safe SQL Assistant for Reservo
Reviews

What students say

These reviews are from enrolled students who completed at least 50% of the course. We moderate reviews only on content grounds (spam, offensive language, personal data), never for being critical or negative.

No approved reviews yet.

Be the first to share your experience!

SEC. 06 · THE STUDIO

Why this studio exists

For decades, building software belonged to technical profiles with years of training, and getting a digital product into the real world took companies months or years. No-code and AI have narrowed that gap, but the knowledge is still held by a few.

Tech Benders exists to open that knowledge up, so business teams and non-technical teams can put their ideas into production with the right technical decisions behind them. AI does what you ask of it. Without a technical base, what it builds may not scale with your company’s ecosystem, and its costs can run away over time.

The team knows the pains of large organizations and the speed at which they have to move. It brings solution architecture, data engineering, product built end to end from back end to front end, and daily work with AI. Software that solves what you need in days, not months, with the cost of AI kept in check.

Founders

The studioRead about Tech Benders →

Write to ushi@techbenders.io

Made with Wislab