<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[DashboardGPT]]></title><description><![CDATA[DashboardGPT]]></description><link>https://dashboardgpt.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 20 Nov 2026 16:31:02 GMT</lastBuildDate><atom:link href="https://dashboardgpt.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Superset text-to-SQL: what works and what breaks]]></title><description><![CDATA[Text-to-SQL handles most everyday questions well. These are the seven patterns where it breaks on a Superset stack, with a concrete fix for each. On a…]]></description><link>https://dashboardgpt.hashnode.dev/superset-text-to-sql-what-works-and-what-breaks</link><guid isPermaLink="true">https://dashboardgpt.hashnode.dev/superset-text-to-sql-what-works-and-what-breaks</guid><category><![CDATA[Apache Superset]]></category><category><![CDATA[conversational-ai]]></category><dc:creator><![CDATA[DashboardGPT]]></dc:creator><pubDate>Wed, 18 Nov 2026 14:52:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6afbfb8396908896efdd9797/2f48e9cc-2e19-41c0-a5b5-a0231ba4b18b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Text-to-SQL handles most everyday questions well. These are the seven patterns where it breaks on a Superset stack, with a concrete fix for each.</p>
<h2>Key takeaways</h2>
<ul>
<li>Single-table aggregates, filters, rankings and simple time series work reliably.</li>
<li>Failures cluster around joins, date grains, ambiguous columns, NULLs, time zones, business definitions and very wide tables.</li>
<li>Almost every fix is better context, not a bigger model: grain, join keys, definitions and value labels.</li>
<li>Keep an evaluation set of real questions and rerun it after every change.</li>
</ul>
<h2>What works well</h2>
<p>On a clean schema, text-to-SQL on Superset handles most everyday business questions reliably:</p>
<ul>
<li><strong>Aggregates on one table:</strong> "Total revenue last quarter", "Average order value by channel".</li>
<li><strong>Filters:</strong> "Orders over $500 in the West region".</li>
<li><strong>Rankings:</strong> "Top 10 customers by revenue this year".</li>
<li><strong>Simple time series:</strong> "Signups by week for the last 12 weeks".</li>
<li><strong>Counts and distincts:</strong> "Unique customers by month".</li>
</ul>
<p>These questions map cleanly to a single <code>SELECT ... GROUP BY</code>, and the model rarely gets them wrong when column names are clear.</p>
<h2>What breaks, and how to fix it</h2>
<h3>1. Joins that change the grain</h3>
<p><strong>Question:</strong> <em>"Revenue by product category."</em></p>
<p><strong>What goes wrong:</strong> revenue lives on <code>orders</code>, category lives on <code>order_items</code>. Joining them repeats each order's total once per line item, so revenue is multiplied.</p>
<pre><code class="language-sql">-- Wrong: order_total repeated for every line item
SELECT i.category, SUM(o.order_total)
FROM orders o JOIN order_items i ON i.order_id = o.id
GROUP BY 1;

-- Right: sum at the line-item grain
SELECT i.category, SUM(i.line_total)
FROM order_items i
GROUP BY 1;
</code></pre>
<p><strong>Fix:</strong> record each table's grain and which measures belong to which grain in the schema profile. Tell the model to aggregate measures at their own grain.</p>
<h3>2. Date grains and averages</h3>
<p><strong>Question:</strong> <em>"Average daily signups per month."</em></p>
<p><strong>What goes wrong:</strong> the model averages signups across rows instead of first counting per day, or averages monthly totals when you wanted daily averages.</p>
<p><strong>Fix:</strong> state the rule in the prompt: aggregate to the requested grain first, then average. Include a worked example in the prompt for "average X per Y".</p>
<h3>3. Ambiguous columns</h3>
<p><strong>Question:</strong> <em>"Revenue last month."</em></p>
<p><strong>What goes wrong:</strong> the table has <code>gross_amount</code>, <code>net_amount</code> and <code>amount_after_refunds</code>. The model picks one.</p>
<p><strong>Fix:</strong> mark the default measure for each business term in the profile, and let the model return a clarifying question when a term has no default.</p>
<h3>4. NULLs and status codes</h3>
<p><strong>Question:</strong> <em>"How many active subscriptions?"</em></p>
<p><strong>What goes wrong:</strong> "active" means <code>canceled_at IS NULL</code>, but the model filters on <code>status = 'active'</code>, which your billing system never updates. Or <code>status = 3</code> means cancelled and the model has no way to know.</p>
<p><strong>Fix:</strong> write business definitions as SQL once (<code>active: canceled_at IS NULL</code>) and map code values to labels during profiling.</p>
<h3>5. Time zones</h3>
<p><strong>Question:</strong> <em>"Orders yesterday."</em></p>
<p><strong>What goes wrong:</strong> timestamps are stored in UTC; "yesterday" for a team in India or California starts at a different moment. Daily counts do not match the store dashboard.</p>
<p><strong>Fix:</strong> set a workspace time zone and have the prompt convert timestamps before truncating to dates.</p>
<h3>6. Business definitions that differ by team</h3>
<p><strong>Question:</strong> <em>"Churn rate by plan."</em></p>
<p><strong>What goes wrong:</strong> finance means revenue churn, product means logo churn, and some count downgrades. Every answer is "right" by one definition.</p>
<p><strong>Fix:</strong> agree on one named definition per metric, store it, and have the answer state which definition was used.</p>
<h3>7. Very wide or many tables</h3>
<p><strong>Question:</strong> anything, on a schema with hundreds of tables.</p>
<p><strong>What goes wrong:</strong> the whole schema does not fit in the prompt, or the model picks a similarly named table from the wrong domain.</p>
<p><strong>Fix:</strong> retrieve only the relevant tables for each question (by name, description and past usage), and prefer curated, pre-joined views for common topics.</p>
<h2>Quick reference</h2>
<table>
<thead>
<tr>
<th>Pattern</th>
<th>Symptom</th>
<th>Fix</th>
</tr>
</thead>
<tbody><tr>
<td>Join fan-out</td>
<td>Totals too high</td>
<td>Record grain; aggregate at the measure's grain</td>
</tr>
<tr>
<td>Date grain</td>
<td>Averages look off</td>
<td>Aggregate first, then average</td>
</tr>
<tr>
<td>Ambiguous column</td>
<td>Plausible but wrong number</td>
<td>Default measure per term; clarifying questions</td>
</tr>
<tr>
<td>NULLs and codes</td>
<td>Counts wrong</td>
<td>Definitions as SQL; label code values</td>
</tr>
<tr>
<td>Time zones</td>
<td>Daily counts shifted</td>
<td>Workspace time zone</td>
</tr>
<tr>
<td>Definitions</td>
<td>Teams disagree</td>
<td>One named definition per metric</td>
</tr>
<tr>
<td>Wide schemas</td>
<td>Wrong table picked</td>
<td>Retrieve relevant tables; curated views</td>
</tr>
</tbody></table>
<h2>Measure it</h2>
<p>Collect 50 to 100 real questions, write the correct SQL or answer for each, and rerun the set after every change to prompts, profiles or models. Track correct, clarified and wrong separately. A drop in "wrong" matters more than a rise in "correct".</p>
<h2>How DashboardGPT handles these</h2>
<p>DashboardGPT profiles columns on upload or connection, detects types and roles, runs queries through Apache Superset and shows the query behind every chart, so you can check the grain, filters and definitions used. For the bigger picture, read <a href="https://www.dashboardgpt.org/learn/apache-superset-ai">Apache Superset + AI</a>.</p>
<blockquote>
<p><strong>Try it on the demo data:</strong> “What is monthly churn rate by plan since January?” <a href="https://www.dashboardgpt.org/playground">See the query behind the answer</a></p>
</blockquote>
<h2>Frequently asked questions</h2>
<h3>Does Superset have text-to-SQL built in?</h3>
<p>Superset provides SQL Lab and charting. Natural-language to SQL is added by a layer on top, such as DashboardGPT.</p>
<h3>Why does text-to-SQL double-count revenue?</h3>
<p>Usually because a join to a more detailed table repeats each row's value. Aggregate measures at their own grain.</p>
<h3>Will a bigger model fix accuracy problems?</h3>
<p>Rarely on its own. Most errors come from missing context about grain, definitions and values.</p>
<h3>How do I handle "active", "churn" and other business terms?</h3>
<p>Define each one once as SQL, store it with the schema profile and have answers state which definition they used.</p>
<h3>How do I test text-to-SQL quality?</h3>
<p>Build an evaluation set of real questions with known answers and rerun it after every change.</p>
<hr />
<p><em>Originally published on <a href="https://www.dashboardgpt.org/learn/superset-text-to-sql">DashboardGPT Learn</a>. DashboardGPT lets you ask questions of your data in plain English and get charts back. You can <a href="https://www.dashboardgpt.org/playground">try it in the playground</a> without an account.</em></p>
]]></content:encoded></item><item><title><![CDATA[Apache Superset + AI: adding natural language to your BI stack]]></title><description><![CDATA[We run DashboardGPT's questions on Apache Superset. This guide covers what AI means for Superset today, three ways to add plain-English questions, the…]]></description><link>https://dashboardgpt.hashnode.dev/apache-superset-ai-adding-natural-language-to-your-bi-stack</link><guid isPermaLink="true">https://dashboardgpt.hashnode.dev/apache-superset-ai-adding-natural-language-to-your-bi-stack</guid><dc:creator><![CDATA[DashboardGPT]]></dc:creator><pubDate>Wed, 18 Nov 2026 14:48:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6afbfb8396908896efdd9797/62f27395-9764-4c74-9ed8-093014a509ac.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>We run DashboardGPT's questions on Apache Superset. This guide covers what AI means for Superset today, three ways to add plain-English questions, the architecture behind them, where they break and the safety rules to set first.</p>
<h2>Key takeaways</h2>
<ul>
<li>Superset runs queries and draws charts, but expects people to write SQL or build charts by hand. Plain-English questions come from a layer you add.</li>
<li>There are three ways to add that layer: a helper inside SQL Lab, a separate text-to-SQL service, or a canvas on top of Superset.</li>
<li>Five steps turn a question into a chart: schema context, prompt, SQL checks, running it through Superset and choosing the chart. Most wrong answers come from unclear data, not the model.</li>
<li>You can build this yourself on Superset. Or you can use a tool like DashboardGPT that already runs it on Superset.</li>
</ul>
<h2>What AI in Superset means today</h2>
<p><a href="https://superset.apache.org/docs/intro">Apache Superset</a> is a popular open-source BI tool (BI means business intelligence, the charts and reports a company runs on). It connects to most SQL databases and has a SQL editor called SQL Lab, many chart types and a dashboard builder. For teams that want BI without licence fees, it is a natural choice.</p>
<p>Its limit is the person using it. To get value from Superset, you write SQL in SQL Lab or build charts by hand. That is fine for analysts. But a sales lead or a founder may just want to know <em>why churn went up last month</em>. For them, SQL is a wall.</p>
<p>AI can remove that wall, and it shows up in three places:</p>
<ul>
<li><strong>Built in.</strong> Superset adds features with each release. Check the release notes for the version you run, because this area moves fast.</li>
<li><strong>Plugins and add-ons.</strong> Community extensions that help someone writing SQL, for example by drafting a query inside SQL Lab. The person still reads and checks the SQL.</li>
<li><strong>An external layer.</strong> A separate tool that takes a plain-English question, writes the query, sends it to Superset to run and brings the chart back. Superset keeps doing what it is good at.</li>
</ul>
<p>Which one you need depends on who asks the questions. If your analysts already live in SQL Lab, a helper there saves time. If the people asking cannot read SQL, you need a layer that works in plain English and shows the SQL only when someone asks.</p>
<p>We run natural-language questions on Superset in production for DashboardGPT. The trade-offs in this guide come from running it, not from a demo.</p>
<h2>Three ways to add natural language to Superset</h2>
<p>Teams usually pick one of three routes. The table shows who each suits and what it costs you.</p>
<table>
<thead>
<tr>
<th>Approach</th>
<th>Who it suits</th>
<th>What you build or buy</th>
<th>Main trade-off</th>
</tr>
</thead>
<tbody><tr>
<td><strong>SQL Lab assistant</strong></td>
<td>Analysts who already read SQL</td>
<td>A helper inside the SQL editor that drafts a query for review</td>
<td>Needs someone who can check SQL, and answers stay inside SQL Lab</td>
</tr>
<tr>
<td><strong>External text-to-SQL service</strong></td>
<td>Teams with platform engineers</td>
<td>A separate service with column profiling, prompts, query checks, an interface and permissions</td>
<td>The most control, and the most upkeep</td>
</tr>
<tr>
<td><strong>A canvas on top of Superset</strong></td>
<td>Mixed teams, including people who do not write SQL</td>
<td>A chat and canvas layer where Superset runs the queries and draws the charts</td>
<td>Less custom control. Follow-up questions and context come ready-made</td>
</tr>
</tbody></table>
<h3>SQL Lab assistant</h3>
<p>This is the smallest step. An analyst types a request, the helper drafts a query, and the analyst reads it, fixes it and runs it. It speeds up people who already know SQL. It does not help the colleague who cannot read the query, so it rarely changes who gets answers.</p>
<h3>External text-to-SQL service</h3>
<p>Here you build the full path yourself: profiling, prompts, checks, an interface and permissions. It gives you control over every step, including which AI model you call. It also makes you the owner of every fix, and each new model release or Superset upgrade is yours to test.</p>
<h3>A canvas on top of Superset</h3>
<p>Here the layer is a product. Answers land as cards you can move, group and link to the question they came from, and a follow-up knows which chart you mean. You give up some control over the internals. In return you skip the build and get the whole line of thought on one page.</p>
<p>A few questions help you choose:</p>
<ul>
<li>Who will ask the questions: analysts, or people who do not write SQL?</li>
<li>Do answers need to be kept, moved around and built on, or is each question a one-off?</li>
<li>Do you have engineers who can own prompts, query checks and permissions over the long run?</li>
<li>Must the data and the AI calls stay inside your own network?</li>
</ul>
<p>DashboardGPT takes the third route. If you want the first two, the guide to <a href="https://www.dashboardgpt.org/learn/superset-natural-language-questions">building an LLM chat interface for Superset</a> walks through the code.</p>
<h2>Architecture: from question to chart</h2>
<p>Whichever route you choose, a question takes the same five steps to become a Superset chart. The AI layer handles the first three. Superset runs the query and draws the result.</p>
<img src="https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/fpieljl8uzfyvzmxlsqa.png" alt="Diagram of five steps from a plain-English question to a chart. The AI layer builds the schema context, builds the prompt and checks the SQL. Then Apache Superset runs the query and the chart is chosen." style="display:block;margin:0 auto" />

<p>Schema context, prompt and checks come from the AI layer. Superset runs the query.</p>
<h3>1. Schema context</h3>
<p>A schema is the list of tables and columns in your data. Before the AI can write a query, it needs to know what each column means, and names alone rarely help. Column names like <code>amt</code>, <code>dt</code> and <code>status_cd</code> tell a model very little.</p>
<p>Semantic profiling fills the gap. It is a scan that labels each column before anyone asks a question: its type, its role (a date, an amount, a category or an ID), its units and its links to other tables. <a href="https://www.dashboardgpt.org/learn/semantic-column-profiling">Semantic column profiling</a> explains it in more detail. DashboardGPT does this for you when you upload a file or connect a source.</p>
<h3>2. Prompt</h3>
<p>The prompt joins the question, the column labels and a short set of rules, such as which date column to use and what to do when a question is unclear. Good tools work in small steps. First they find the number you want, how to split it and any filters. Then they match each part to a real column, and only then do they write the query.</p>
<p>When the question is genuinely ambiguous, the best answer is a short question back to the user, not a guess.</p>
<h3>3. SQL validation</h3>
<p>The SQL is checked before it runs. It must only read data, never change it, and it can only use tables and columns that exist. It must also stay under set limits on rows and run time. A query that fails a check is repaired or rejected, and never sent to the database.</p>
<h3>4. Execution through the Superset API</h3>
<p>Once a query passes, the layer sends it to Superset, so it runs over the same connection and access rules Superset already uses. Superset has a <a href="https://superset.apache.org/docs/api">REST API</a> for this. A minimal call looks like this:</p>
<pre><code class="language-python">import requests

BASE = "https://superset.example.com"

def run_query(session: requests.Session, database_id: int, sql: str) -&gt; dict:
    # session is already logged in to Superset with a read-only account
    r = session.post(
        f"{BASE}/api/v1/sqllab/execute/",
        json={"database_id": database_id, "sql": sql,
              "runAsync": False, "queryLimit": 5000},
    )
    r.raise_for_status()
    return r.json()
</code></pre>
<p>The guide to <a href="https://www.dashboardgpt.org/learn/superset-natural-language-questions">building an LLM chat interface for Superset</a> has the full version, including the login.</p>
<h3>5. Chart choice</h3>
<p>The shape of the result picks the chart. A single number becomes a metric card, a trend over time becomes a line chart, and a comparison of groups becomes a bar chart. Superset draws the chart, and a short written note explains what it shows and quotes the numbers.</p>
<blockquote>
<p><strong>Try it on the demo data:</strong> “Show weekly active users by plan for the last 12 weeks” <a href="https://www.dashboardgpt.org/playground">Run it on the demo dataset</a></p>
</blockquote>
<h2>Where text-to-SQL breaks, and the fixes</h2>
<p>Most wrong answers come from the data, not the model. Here are the common problems and how to fix each one.</p>
<table>
<thead>
<tr>
<th>Problem</th>
<th>Example</th>
<th>Fix</th>
</tr>
</thead>
<tbody><tr>
<td>Unclear columns</td>
<td>Three date columns: <code>date</code>, <code>created</code> and <code>updated</code>.</td>
<td>Mark the main date column. Ask the user when it is not clear.</td>
</tr>
<tr>
<td>Wrong join</td>
<td>Revenue counted twice after orders are joined to order lines.</td>
<td>Set the join keys in the profile. Use tables that are already summed when you can.</td>
</tr>
<tr>
<td>Date grain</td>
<td>A monthly average worked out as an average of daily averages.</td>
<td>Sum to months first. Then take the average.</td>
</tr>
<tr>
<td>Business terms</td>
<td>Product and sales mean different things by "active user".</td>
<td>Agree on one meaning. Store it once and reuse it.</td>
</tr>
<tr>
<td>Status codes</td>
<td><code>status = 3</code> means "cancelled".</td>
<td>Turn codes into plain labels during profiling.</td>
</tr>
<tr>
<td>Time zones</td>
<td>Daily counts shift at midnight UTC compared with local time.</td>
<td>Set one time zone for the workspace and always use it.</td>
</tr>
</tbody></table>
<p>A join links two tables, such as orders and customers. Date grain is the time unit you count by, such as day, week or month.</p>
<p>The pattern is the same each time. The more meaning you give the AI up front, the less it has to guess. For a deeper look at each problem, read <a href="https://www.dashboardgpt.org/learn/superset-text-to-sql">text-to-SQL failure patterns</a>, which covers seven patterns that break and a fix for each.</p>
<h2>Test it before you trust it</h2>
<p>A plain-English layer that answers confidently and wrongly is worse than no layer. Before you let anyone rely on it, test it on questions where you already know the answer.</p>
<ol>
<li>Pick a table you already chart in Superset and know well.</li>
<li>Write ten to twenty questions, from simple ("total revenue last month") to hard ("revenue per customer by plan, excluding refunds").</li>
<li>Compare each answer with the number you already trust, and note which of the common problems above caused every miss.</li>
<li>Fix the cause once, in the column labels or the shared definitions, and ask the failed questions again.</li>
<li>Repeat after every change to the data, the prompts or the AI model.</li>
</ol>
<p>Our <a href="https://www.dashboardgpt.org/learn/50-questions-ai-accuracy">50-question accuracy test kit</a> gives you a ready-made set in five levels of difficulty, plus a way to score the results. It works on any tool, not only ours.</p>
<h2>Build or buy: guardrails, row-level security and tenant isolation</h2>
<p>You can build a plain-English layer on Superset yourself. You will need column profiling, prompts for the model, SQL checks and chart rules, plus an interface, permissions and a plan for model updates. That can make sense for a team with platform engineers who want to own every part.</p>
<p>Whichever way you go, set these guardrails before the first live question. Guardrails are rules that stop a query from doing harm.</p>
<ul>
<li><strong>Read-only access.</strong> The AI's database login should never be able to write or delete.</li>
<li><strong>Row and time limits.</strong> Cap how many rows come back and how long a query can run, so one broad question cannot slow the database.</li>
<li><strong>Show the SQL.</strong> Every answer should let the user open the query behind it.</li>
<li><strong>Log questions and queries.</strong> The log shows which terms confuse people and where the profile needs work.</li>
<li><strong>Keep AI keys under your control.</strong> With <a href="https://www.dashboardgpt.org/learn/bring-your-own-key">bring your own key</a>, the AI calls run on your own account. You choose the provider, the model and the spending limit.</li>
</ul>
<h3>Row-level security</h3>
<p>People should only see data they are allowed to see. Superset supports <a href="https://superset.apache.org/docs/security/">row-level security and roles</a> for its own users. If your AI layer connects with one shared account, those rules do not follow the person asking. You then need to apply the same rules in the layer, or run each query as the person who asked.</p>
<h3>Tenant isolation</h3>
<p>If several teams or customers share the layer, keep their data, questions and answers apart. A mistake here shows one team's numbers to another, so test it as carefully as you test the answers.</p>
<h3>What DashboardGPT ships</h3>
<p>DashboardGPT builds these parts on top of Superset, so you do not have to:</p>
<ul>
<li>Automatic profiling of uploaded files and connected sources.</li>
<li>Questions turned into SQL, with checks before anything runs.</li>
<li>Charts drawn by Superset, with written notes that quote their numbers.</li>
<li>An infinite canvas where follow-up questions keep their context.</li>
<li>Bring your own AI key on every plan.</li>
<li>Each workspace kept apart from every other, with roles for who sees what. Private or <a href="https://www.dashboardgpt.org/on-premise">self-hosted</a> setup is on Enterprise.</li>
</ul>
<blockquote>
<p><strong>Try it on the demo data:</strong> “Which plan has the highest churn rate this quarter?” <a href="https://www.dashboardgpt.org/playground">See the Superset-powered answer</a></p>
</blockquote>
<h2>Getting answers back into Superset dashboards</h2>
<p>Superset dashboards are built for watching known numbers. They show a fixed set of charts that refresh on a schedule, and they do that job well, so keep them. Exploring is a different job. When you want to know <em>why</em> a number moved, you ask a question, look at the answer and ask a narrower one. A fixed grid makes that slow. Our look at <a href="https://www.dashboardgpt.org/learn/superset-dashboards-to-canvas">moving from dashboards to a canvas</a> explains why.</p>
<p>Most teams split the work like this: Superset dashboards for the weekly numbers everyone watches, and a conversational canvas for the questions those numbers raise. The two connect in both directions:</p>
<ul>
<li><a href="https://www.dashboardgpt.org/learn/publish-canvas-to-superset">Publish a canvas to Superset</a>. Turn a canvas of answers into a Superset dashboard laid out the same way.</li>
<li><a href="https://www.dashboardgpt.org/learn/embed-superset-dashboards">Embed Superset dashboards</a>. Show Superset dashboards inside your workspace, with no Superset accounts to manage.</li>
<li><a href="https://www.dashboardgpt.org/learn/canvas-and-superset-charts-match">Check that the charts match</a>. One question, one query, so the two views of a chart never disagree.</li>
</ul>
<h2>Getting started</h2>
<ol>
<li><strong>Try the playground.</strong> See plain-English questions answered by Superset charts on a demo dataset, with no signup.</li>
<li><strong>Upload a CSV or Excel export.</strong> Pick a table you already chart in Superset, and ask the same questions in plain English.</li>
<li><strong>Compare the results</strong> with your Superset chart to check that the numbers match.</li>
<li><strong>Plan for live data.</strong> Warehouse connections are coming soon on the Team plan.</li>
</ol>
<p>Ready to try it? <a href="https://www.dashboardgpt.org/playground">Open the playground</a>, <a href="https://www.dashboardgpt.org/signup">sign up</a>, look at <a href="https://www.dashboardgpt.org/pricing">pricing</a> or <a href="https://www.dashboardgpt.org/contact">contact us</a> if you want a private setup.</p>
<h2>Frequently asked questions</h2>
<h3>Does Apache Superset have built-in AI?</h3>
<p>Superset runs queries and draws charts. Plain-English questions are usually added as a layer on top, and Superset adds features with each release, so check the notes for the version you run. DashboardGPT is one such layer. It uses Superset to run queries and draw charts, and adds chat and an infinite canvas.</p>
<h3>Can I ask Superset questions in plain English?</h3>
<p>Yes, with a plain-English layer on top. Your question is turned into SQL and checked, then Superset runs it on your database. You get back a chart with a short written explanation.</p>
<h3>Is text-to-SQL accurate enough for business use?</h3>
<p>It is accurate for most everyday questions when the columns are well described. It gets worse with unclear column names, complex joins and business terms people disagree on. That is why column profiling and visible SQL matter.</p>
<h3>Does this replace my Superset dashboards?</h3>
<p>No. Dashboards are best for watching known numbers. A conversational canvas is best for exploring the questions those dashboards raise. Most teams use both.</p>
<h3>How do I stop AI queries from changing my data?</h3>
<p>Give the AI layer a read-only database login, check every query before it runs, and cap rows and run time. Showing the SQL behind each answer lets people spot a problem early.</p>
<h3>Which databases work?</h3>
<p>Superset supports most SQL databases. In DashboardGPT, CSV and Excel uploads work on every plan. Warehouse connections are coming soon on the Team plan.</p>
<hr />
<p><em>Originally published on</em> <a href="https://www.dashboardgpt.org/learn/apache-superset-ai"><em>DashboardGPT Learn</em></a><em>. DashboardGPT lets you ask questions of your data in plain English and get charts back. You can</em> <a href="https://www.dashboardgpt.org/playground"><em>try it in the playground</em></a> <em>without an account.</em></p>
]]></content:encoded></item><item><title><![CDATA[How to add an LLM chat interface to Apache Superset]]></title><description><![CDATA[A build guide for a chat panel on Superset: schema context for the model, prompt design, SQL validation, execution through Superset, a chart for every…]]></description><link>https://dashboardgpt.hashnode.dev/how-to-add-an-llm-chat-interface-to-apache-superset</link><guid isPermaLink="true">https://dashboardgpt.hashnode.dev/how-to-add-an-llm-chat-interface-to-apache-superset</guid><dc:creator><![CDATA[DashboardGPT]]></dc:creator><pubDate>Fri, 13 Nov 2026 05:00:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6afbfb8396908896efdd9797/bbfc0636-367e-4728-a3be-8bfeae13c99a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A build guide for a chat panel on Superset: schema context for the model, prompt design, SQL validation, execution through Superset, a chart for every answer and follow-up questions that build on the last one.</p>
<h2>Key takeaways</h2>
<ul>
<li>An LLM chat interface on Superset has six parts: schema context, prompt, validation, execution, chart selection and conversation history.</li>
<li>Schema context matters more than the model. Describe columns, grains and business definitions explicitly.</li>
<li>Validate every generated query before it runs: read-only, known tables only, a row limit and a timeout.</li>
<li>Run queries through Superset so existing database connections and permissions still apply.</li>
</ul>
<h2>How the chat interface works</h2>
<p>An LLM chat interface on Apache Superset is a chat panel backed by a small service that sits between the user and Superset's query engine. Each message flows through five stages, and a sixth keeps the conversation together:</p>
<ol>
<li><strong>Schema context:</strong> collect a compact description of the tables and columns the user may query.</li>
<li><strong>Prompt:</strong> send the question plus that context to a language model and ask for SQL.</li>
<li><strong>Validation:</strong> parse the SQL and reject anything unsafe or invalid before it runs.</li>
<li><strong>Execution:</strong> run the query through Superset against the database.</li>
<li><strong>Presentation:</strong> choose a chart for the result and write a short explanation.</li>
<li><strong>Conversation:</strong> keep the thread's history so a follow-up builds on the previous answer.</li>
</ol>
<p>Each stage can fail on its own, so build and test them separately. The code below is illustrative Python; adapt it to your stack and your Superset version.</p>
<p>For the wider picture of AI on Superset, start with the <a href="https://www.dashboardgpt.org/learn/apache-superset-ai">Apache Superset AI guide</a>. For the question patterns that trip up generated SQL, see <a href="https://www.dashboardgpt.org/learn/superset-text-to-sql">Superset text-to-SQL: what breaks</a>.</p>
<h2>Stage 1: Build the schema context</h2>
<p>The model only knows what you tell it. Raw <code>information_schema</code> output is too noisy and too thin at the same time: it lists every column but explains none.</p>
<p>Build a compact profile per table instead:</p>
<pre><code class="language-yaml">table: subscriptions
grain: one row per subscription change
columns:
  - name: customer_id      role: id        note: join key to customers.id
  - name: plan             role: category  values: [starter, team, enterprise]
  - name: mrr_usd          role: measure   unit: USD per month
  - name: started_at       role: time      primary: true  tz: UTC
  - name: canceled_at      role: time      note: null if active
definitions:
  active_subscription: canceled_at IS NULL
  churned_in_month: date_trunc('month', canceled_at) = :month
</code></pre>
<p>Three parts of this matter most:</p>
<ul>
<li><strong>Grain:</strong> what one row represents. Most wrong totals come from getting this wrong.</li>
<li><strong>Roles:</strong> which columns are measures, categories, times and IDs.</li>
<li><strong>Definitions:</strong> the business terms people actually use, written once as SQL.</li>
</ul>
<p>In DashboardGPT this profile is generated automatically when a file is uploaded or a source is connected, then refined as columns are confirmed.</p>
<h2>Stage 2: Write the prompt</h2>
<p>Keep the prompt structured and strict. A good pattern:</p>
<pre><code class="language-text">You write SQL for {dialect}. Use only the tables and columns below.
Return one SELECT statement and nothing else.

Schema:
{schema_profile}

Rules:
- Use the primary time column for "last N days/months" unless told otherwise.
- Aggregate to the grain the user asks for before averaging.
- Use the definitions section for business terms.
- If the question is ambiguous, return: AMBIGUOUS: &lt;one short question&gt;.
- Always include LIMIT {row_limit}.

Question: {question}
</code></pre>
<p>The <code>AMBIGUOUS</code> escape hatch matters. A model that asks <em>"Gross or net revenue?"</em> is far more useful than one that guesses.</p>
<p>For follow-up questions, include the previous question and its SQL in the context, so <em>"now only enterprise"</em> modifies the last query instead of starting over.</p>
<h2>Stage 3: Validate the SQL</h2>
<p>Never run generated SQL directly. Parse it and check it first. With the <code>sqlglot</code> library:</p>
<pre><code class="language-python">import sqlglot
from sqlglot import exp

ALLOWED_TABLES = {"subscriptions", "customers", "invoices"}

def validate(sql: str, dialect: str, row_limit: int = 5000) -&gt; str:
    statements = sqlglot.parse(sql, read=dialect)
    if len(statements) != 1:
        raise ValueError("Exactly one statement is allowed")
    tree = statements[0]
    if not isinstance(tree, exp.Select):
        raise ValueError("Only SELECT queries are allowed")
    tables = {t.name for t in tree.find_all(exp.Table)}
    unknown = tables - ALLOWED_TABLES
    if unknown:
        raise ValueError(f"Unknown tables: {sorted(unknown)}")
    if not tree.args.get("limit"):
        tree = tree.limit(row_limit)
    return tree.sql(dialect=dialect)
</code></pre>
<p>Add checks for your environment: known columns only, no cross-database references, and a cap on the date range for very large tables. Also connect with a <strong>read-only database user</strong>, so a validation gap can never become a write.</p>
<h2>Stage 4: Execute through Superset</h2>
<p>Running queries through Superset, rather than directly against the database, means you reuse the database connections, drivers and access rules your team already maintains.</p>
<p>Superset exposes a REST API. A typical flow authenticates, then submits SQL for a database:</p>
<pre><code class="language-python">import requests

BASE = "https://superset.example.com"

def superset_session(username: str, password: str) -&gt; requests.Session:
    s = requests.Session()
    r = s.post(f"{BASE}/api/v1/security/login",
               json={"username": username, "password": password,
                     "provider": "db", "refresh": True})
    r.raise_for_status()
    s.headers["Authorization"] = f"Bearer {r.json()['access_token']}"
    csrf = s.get(f"{BASE}/api/v1/security/csrf_token/").json()["result"]
    s.headers["X-CSRFToken"] = csrf
    return s

def run_sql(s: requests.Session, database_id: int, sql: str) -&gt; dict:
    r = s.post(f"{BASE}/api/v1/sqllab/execute/",
               json={"database_id": database_id, "sql": sql,
                     "runAsync": False, "queryLimit": 5000})
    r.raise_for_status()
    return r.json()
</code></pre>
<p>Endpoints and payloads vary between Superset versions, so check the API reference for yours. Use a dedicated service account with access only to the databases and schemas the natural-language layer should reach, and set query timeouts on the database connection.</p>
<h2>Stage 5: Choose the chart and explain it</h2>
<p>Pick the visual from the shape of the result, not from the question text:</p>
<table>
<thead>
<tr>
<th>Result shape</th>
<th>Chart</th>
</tr>
</thead>
<tbody><tr>
<td>One row, one number</td>
<td>Metric card</td>
</tr>
<tr>
<td>A time column plus one measure</td>
<td>Line chart</td>
</tr>
<tr>
<td>A time column plus a category plus a measure</td>
<td>Multi-line or stacked bars</td>
</tr>
<tr>
<td>A category plus a measure, up to about 15 rows</td>
<td>Bar chart, sorted</td>
</tr>
<tr>
<td>A category plus a measure, parts of a whole, up to 5 rows</td>
<td>Share chart</td>
</tr>
<tr>
<td>Many columns or many rows</td>
<td>Table</td>
</tr>
</tbody></table>
<p>Then write a short explanation from the result itself: the largest value, the biggest change and anything unusual. Pass the aggregated rows to the model, not raw data, and ask it to cite the figures it uses. Show the SQL next to the chart so anyone can check it.</p>
<h2>Stage 6: Make it a conversation</h2>
<p>The first five stages answer one question. What makes it a chat interface is how it handles the next one. People rarely ask a perfect question first; they ask, look at the chart and refine.</p>
<ul>
<li><strong>Store each turn.</strong> Keep the question, the validated SQL and a short summary of the result for every message in the thread. Store the summary, not the raw rows.</li>
<li><strong>Send recent turns with each message.</strong> With the last few questions and their SQL in the prompt, <em>"and last quarter?"</em> changes the date filter of the previous query instead of starting over.</li>
<li><strong>Ask back in the thread.</strong> When the model returns <code>AMBIGUOUS</code>, show its question as a chat message and use the reply as context for the next attempt.</li>
<li><strong>Show the working in every reply.</strong> Put the chart, the short explanation and the SQL in each answer, so the user can spot a misread question and rephrase it.</li>
<li><strong>Show progress.</strong> Display a status such as "Running the query" while Superset executes, so a slow query does not look like a frozen chat.</li>
<li><strong>Cap the history.</strong> Summarise or drop older turns so the prompt stays within the model's context window and the cost per message stays predictable.</li>
</ul>
<h2>Testing the chat interface</h2>
<p>Build an evaluation set before you ship:</p>
<ol>
<li>Collect 50 to 100 real questions from the people who will use it.</li>
<li>For each, write the correct SQL or the correct answer.</li>
<li>Run the set after every change to the prompt, the schema profile or the model.</li>
<li>Include short conversations as well as single questions, so follow-ups such as "now only enterprise" are tested too.</li>
<li>Track three rates: correct, ambiguous (the model asked a question) and wrong.</li>
</ol>
<p>A falling "wrong" rate matters more than a rising "correct" rate. An answer that asks for clarification is safe; a confident wrong number is not.</p>
<h2>Or use one that already exists</h2>
<p>Building a chat interface well takes profiling, prompts, validation, execution, chart selection, conversation handling and continuous evaluation. DashboardGPT provides these on top of Apache Superset, with an infinite canvas where every follow-up keeps its own chart, and bring-your-own-key for the model.</p>
<blockquote>
<p><strong>Try it on the demo data:</strong> “Show weekly active users by plan for the last 12 weeks” <a href="https://www.dashboardgpt.org/playground">See the Superset-powered answer</a></p>
</blockquote>
<h2>Frequently asked questions</h2>
<h3>Can Apache Superset answer natural-language questions?</h3>
<p>Superset executes SQL and renders charts. Natural-language questions come from a layer on top that turns a question into validated SQL and runs it through Superset.</p>
<h3>Which language model should I use for text-to-SQL?</h3>
<p>Most current large models write good SQL when the schema context is clear. Test two or three on your own evaluation set; schema quality usually matters more than the model choice.</p>
<h3>How do I stop the AI from running dangerous queries?</h3>
<p>Allow only single SELECT statements, check tables and columns against an allowlist, add a row limit, set a timeout and use a read-only database user.</p>
<h3>Should queries run through Superset or directly against the database?</h3>
<p>Through Superset if you already use it, so the same connections, drivers and access rules apply and results can be rendered as Superset charts.</p>
<h3>How do I handle follow-up questions?</h3>
<p>Include the previous question and its SQL in the prompt, so the model modifies the last query instead of writing a new one from scratch.</p>
<hr />
<p><em>Originally published on <a href="https://www.dashboardgpt.org/learn/superset-natural-language-questions">DashboardGPT Learn</a>. DashboardGPT lets you ask questions of your data in plain English and get charts back. You can <a href="https://www.dashboardgpt.org/playground">try it in the playground</a> without an account.</em></p>
]]></content:encoded></item></channel></rss>