> Markdown version of [/videos/100127-beyond-sql-generation-how-to-teach-agents-what-your-database-actually-means](https://www.wearedevelopers.com/videos/100127-beyond-sql-generation-how-to-teach-agents-what-your-database-actually-means). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # Beyond SQL Generation: How to Teach Agents What Your Database Actually Means AI agents write perfect SQL but often fail at actual business logic. Discover how semantic YAML models teach LLMs your data's true context and prevent costly hallucinations. - **Speakers:** [Celeste Horgan](https://www.wearedevelopers.com/@celeste-horgan) - **Event:** World Congress 2026 Europe - **Published:** July 9, 2026 - **Duration:** 12:42 - **URL:** https://www.wearedevelopers.com/videos/100127-beyond-sql-generation-how-to-teach-agents-what-your-database-actually-means ## Summary Coding agents excel at generating syntactically valid SQL, but they frequently fail at fetching accurate, context-aware answers because they lack deep domain knowledge. Using a real-world dataset of professional football performance analyzed within Snowflake, this talk illustrates how an LLM can parse basic metrics—like wins and losses—to confidently return a logically sound but practically misleading conclusion. Agents often disregard nuanced statistics, such as expected goals (xG) or opponent difficulty, simply because column names lack self-evident meaning or contain null values that confuse the model without explicit guidance. To bridge this gap between functional SQL syntax and business reality, developers must explicitly teach AI agents what the underlying data actually means. The standard methodology for encoding this domain context is a semantic model: a structured YAML file, version-controlled alongside the database schema. Functioning conceptually similarly to DBT but operating at definition time, semantic models provide a definitive guide to database layouts, join logic, column definitions, and baseline query expectations. By defining exactly when to rely on specific metrics and how to weigh data attributes contextually, developers can transform a naive AI into a scalable, highly effective database analyst. Implementing standardized semantic models ensures that agents do not discard critical insights or burn tokens on hallucinations, ultimately enabling them to one-shot accurate results from complex structured databases. **Keywords:** SQL generation, semantic models, domain knowledge encoding, LLM database queries, snowflake AI agents, structured data context, database schema catalogs, context-aware SQL, YAML schema definitions, DBT integration, combating AI hallucinations, scalable database analysts, automated query generation, business logic definitions ## Chapters 1. **Contextualizing data challenges through Canadian football fandom** (00:12) — An anecdote about sudden national interest in sports illustrates the necessity of specific domain knowledge. 1. **Evaluating large language model responses to sports data** (03:53) — Initial coding agent queries return technically correct answers that fail to capture the nuanced reality of team performance improvements. 1. **Identifying critical gaps in language model schema interpretation** (06:50) — Coding agents often disregard semantically unclear statistical columns without explicit guidance and structural database context. 1. **Analyzing valid structural query code lacking domain meaning** (09:37) — Perfectly executable database queries generated by an agent fall short without explicit situational metric instructions. 1. **Defining semantic models for agentic data application workflows** (11:44) — Structured configuration files stored alongside database schemas teach coding agents the practical meaning of specialized organizational columns. ## Related Moments - [Modeling semantic database layers for reliable SQL queries](https://www.wearedevelopers.com/videos/100025-scaling-graphrag-efficient-knowledge-retrieval-for-ai) (from "Scaling GraphRAG: Efficient Knowledge Retrieval for AI") - [Introducing conversational queries with AI data agents](https://www.wearedevelopers.com/videos/1547-data-analytics-with-microsoft-fabric-end-to-end-use-case-with-data-agents) (from "Data Analytics with Microsoft Fabric: End-to-End Use Case with Data Agents") - [Enabling direct language model interaction with database structures](https://www.wearedevelopers.com/videos/2088-plan-to-link-your-llm-to-your-production-database-what-could-possibly-go-wrong) (from "Plan to link your LLM to your production database? What could possibly go wrong?") - [Implementing the trusted intelligence layer for AI semantics](https://www.wearedevelopers.com/videos/100286-the-missing-layer-between-enterprise-data-and-ai-agents) (from "The Missing Layer Between Enterprise Data and AI Agents") - [Transforming unstructured email data into customized user knowledge graphs](https://www.wearedevelopers.com/videos/100128-the-golden-age-of-email-owning-the-inbox-in-the-age-of-ai) (from "The Golden Age of Email: Owning the Inbox in the Age of AI") - [Querying unstructured expedition data with conversational artificial intelligence](https://www.wearedevelopers.com/videos/100177-hacking-ai-at-the-edge-of-the-indian-ocean) (from "Hacking AI at the Edge of the Indian Ocean") ## Related Articles - [Graph and AI Trends 2026: Why Is AI Running but Not Yet Delivering?](https://www.wearedevelopers.com/magazine/680-graph-and-ai-trends-2026-why-is-ai-running-but-not-yet-delivering) - [WWC24 Talk - Scott Hanselman - AI: Superhero or Supervillain?](https://www.wearedevelopers.com/magazine/469-wwc24-talk-scott-hanselman-ai-superhero-or-supervillain) - [The Web We Broke (And Why AI Agents Are Paying the Price) - AgentCon Berlin](https://www.wearedevelopers.com/magazine/735-the-web-we-broke-and-why-ai-agents-are-paying-the-price-agentcon-berlin) - [MLOps And AI Driven Development](https://www.wearedevelopers.com/magazine/82-mlops-and-ai-driven-development) ## Related Jobs - [Data Scientist](https://www.wearedevelopers.com/jobs/ext/1351648-data-scientist) at **Almedia** - [AI Software Engineer (Germany)](https://www.wearedevelopers.com/jobs/48317-ai-software-engineer-germany) at **Sunhat** - [Data & Machine Learning Engineer | Hybrid work](https://www.wearedevelopers.com/jobs/ext/431779-data-machine-learning-engineer-hybrid-work) at **SMG Swiss Marketplace Group** - [Staff Business Intelligence Engineer](https://www.wearedevelopers.com/jobs/ext/626164-staff-business-intelligence-engineer) at **Twilio** - [Senior AI Agent Software Engineer (Go, Python) (m/f/x)](https://www.wearedevelopers.com/jobs/48277-senior-ai-agent-software-engineer-go-python-m-f-x) at **Dynatrace** - [Staff Software Engineer, Copilot Experiences](https://www.wearedevelopers.com/jobs/ext/164361-staff-software-engineer-copilot-experiences) at **GitHub**