Skip to content

Workspace SQL editor: AI-assisted query writing (natural language → SQL) #287

Description

@yustme

Feature request

The SQL editor in the workspace requires writing all queries by hand. I'd like to be able to describe what I want in plain language and have an AI generate (or complete) the SQL for me — without leaving the editor.

Proposed UX

Add an AI prompt bar above (or inline with) the Monaco SQL editor in the workspace view:

┌─────────────────────────────────────────────────────┐
│ Ask AI: show me top 10 customers by revenue last     │
│ month, grouped by country              [Generate ↵]  │
└─────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────┐
│  SELECT customer_country,                           │
│         SUM(revenue) AS total_revenue               │
│  FROM   ...                                         │  ← Monaco editor
└─────────────────────────────────────────────────────┘

Possible interactions:

  • Generate — replaces the current editor content with AI-generated SQL
  • Insert at cursor — inserts the suggestion at the cursor position
  • Explain — describes what the current SQL does in plain language
  • Fix — sends the current query + last error message to the AI and applies the suggested fix

Why this fits kbagent

The backend already has access to the workspace schema (table names, column names via kbagent workspace query / Storage metadata) and to Kai (Keboola's built-in AI). Passing the schema as context to the prompt would make the generated SQL accurate without hallucinating table/column names.

A lightweight v1 could simply pass the user's prompt + the active workspace schema to Kai or the Claude API and stream the response into the editor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions