Skip to content

Commit 6e60911

Browse files
Add AI SQL Query Assistant for database-sourced charts
Adds a natural-language SQL assistant panel to the Source → Import from database tab of the chart editor. Users describe the data they want in plain English and the AI generates a correctly structured, ready-to-run SQL query tailored to the active chart type and database schema. Key features: - Multi-provider support: OpenAI, Gemini, Claude (panel only renders when at least one API key is configured) - Chart-type-aware query generation (correct column count/types per chart) - Table-aware: passes available tables and columns to the AI - Conversational refinement: follow-up prompts modify the existing query rather than starting fresh, using the last generated query as context - MySQL compatibility layer: detects environments where applying date functions to columns in WHERE crashes the connection (e.g. Local by Flywheel) and rewrites generated queries to use safe direct comparisons - Empty-result detection: when a valid WHERE clause returns 0 rows and MySQL drops the connection, pings the DB to distinguish this from a real outage and shows a friendly 'No results found' message instead - Suggestion chips for related query ideas - One-click 'Use This Query' button injects generated SQL into CodeMirror Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 13b7677 commit 6e60911

5 files changed

Lines changed: 2724 additions & 20 deletions

File tree

0 commit comments

Comments
 (0)