SQLLens.AI Docs
Pillar

LLMs & AI

Generate, fix and explain SQL using your provider of choice — with control over what schema context is shared.

Overview

SQLLens.AI adds AI affordances throughout: a Generate SQL CodeLens above empty regions, a Fix with AI action on errors, natural‑language prompts via @AI, and an assist panel for longer conversations.

Enable / disable AI

Toggle skyline-mysql.ai.enabled in Settings → AI. When off, AI CodeLens entries disappear and the assist panel is hidden.

Providers & models

Supported providers include OpenRouter, Groq, Grok, OpenAI, Anthropic, Ollama, and any OpenAI‑compatible custom endpoint. Pick a default model per provider; the assist panel lets you switch on the fly.

Animated demo: AI SQL Copilot — prompt to production SQL in the editor.
Provider picker and model selection in Settings.

API keys & accounts

Keys live in VS Code's Secret Storage, never in settings.json. If you've signed in to sqllens.ai, you can opt into managed routing and skip per‑provider keys.

Schema context & privacy

You decide how much table metadata can accompany prompts: see skyline-mysql.ai.schemaContextMode (structure-only vs none) and skyline-mysql.ai.includeSchemaContext (legacy off switch). Row data is never sent to cloud models.

Note

Even with full schema context, only the names and types of objects referenced by the active query are included — not the whole database.

From the editor (CodeLens)

Generate SQL appears on empty regions and turns a comment like -- top 10 customers last month into a query. Fix with AI appears on the gutter when a statement fails.

Command Palette & panel

Run SQL: Ask AI from the palette to open the assist panel. Use @AI explain, @AI optimize, or @AI fix inline.

Create DB objects with AI

Right‑click a database in the tree and choose Create with AI → table, view, procedure or trigger. The wizard previews the DDL before running.

Troubleshooting

Demo

Animated demo: Generate SQL with AI from the editor.
Generate SQL with AI — provider pick and SELECT generation.