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

Dev.to AI
NLP

A real production system running on an affiliate marketing ERP - not a. The Problem The operations team at an affiliate marketing company I worked with hit a classic wall. 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. But every non-trivial question required SQL. And the people asking the questions weren’t the ones who could write it. The goal: Let a non-technical operator ask a question in plain English and get a real answer instantly. No dashboards. No SQL. No waiting for a de.