How I Built a Production AI Query Engine on 28 Tables — And Why I Used Both Text-to-SQL and…

Towards AI
NLP Data Science

How I Built a Production AI Query Engine on 28 Tables - And Why I Used Both Text-to-SQL and Function Calling A real architecture from an affiliate marketing ERP - with a 3-layer AST security validator, MCP agent actions, and 18 automation workflows running in prod. The Problem The operations team at an affiliate marketing company I worked with had a problem every data-driven business eventually hits. They had all the data. Revenue by affiliate, fraud flags, campaign ROI, conversion rates by traffic source. All of it, live, in a 28-table MySQL database.