Skip to main content
AI Agents & Automation

Natural Language to SQLSolutions

Embed a text-to-SQL component that understands your schema, writes read-only queries, and is tested against the questions your users actually ask.

Natural Language to SQL Solutions: what the work involves

Teams that adopt a quick text-to-SQL demo usually hit the same wall. It works on the sample database, then meets a schema with cryptic column names, soft-deleted rows, three ways of storing a date and a customer table with duplicate entries. The generated query runs, returns a number, and the number is subtly wrong. Nobody notices until a report is quoted in a meeting.

DevKey treats this as an engineering problem with measurable quality. We document the schema in plain language, add join hints and business rules, and give the model only the relevant tables for each question. Generated SQL passes through a parser that enforces read-only access, row limits and allowed objects before it runs. We then build an evaluation set from real questions with verified results, and track execution accuracy as the schema and the model change.

What we build

Core features

01

Schema documentation pass

Tables and columns get descriptions, example values and relationships, which does more for accuracy than any prompt trick.

02

Relevant-table retrieval

For each question the system selects a small set of tables and columns, keeping prompts focused and lowering cost on large schemas.

03

SQL parsing and guardrails

Statements are parsed before execution, blocking writes, unbounded scans, cross-tenant access and anything outside the allowed objects.

04

Self-check and repair

If a query errors or returns an empty result for a suspicious reason, the system retries with the error message, within a bounded number of attempts.

05

Evaluation harness

A suite of question and expected-result pairs runs on every change, producing a report on which question types improved or regressed.

06

Explanations and lineage

Users see a readable description of what the query did, and admins see which tables were touched for audit.

Planned for

What we get right before launch

Ambiguity is normal

Words like revenue or active can map to several definitions. We prefer asking a clarifying question or choosing a documented default over silently picking one, and we show which was used.

Permissions belong in the database

Prompt instructions are not security. Row-level security, read-only roles and separate credentials per tenant make sure that a misbehaving query still cannot expose data it should not.

Cost and latency on big warehouses

An inefficient generated query on a large table can be slow or expensive. We apply cost estimates, limits and caching, and route heavy questions to scheduled jobs instead of blocking the chat.

Stack

Tools and technology

  • OpenAI GPT
  • Anthropic Claude
  • Llama and Mistral models
  • Python
  • sqlglot
  • PostgreSQL
  • BigQuery
  • FastAPI
  • LlamaIndex
Natural Language to SQL Solutions FAQ

Common questions, answered

How accurate is text-to-SQL really?

It varies widely by schema quality and question difficulty. Simple filters and aggregations do well; multi-step logic and ambiguous terms are harder. We report accuracy on your own evaluation set instead of quoting a generic figure.

Can it ever modify or delete our data?

Not by design. Queries run under a read-only role, and a parser rejects anything but permitted selects. If you want write actions, those go through separate, explicitly approved tools with confirmations.

Which databases are supported?

PostgreSQL, MySQL, SQL Server, BigQuery and Snowflake are common. Dialect differences matter, so we configure the generator and parser for your engine and test with its specific functions.

Should we use a hosted model or run our own?

Hosted frontier models currently handle complex schemas better, but they receive schema text and result samples. A self-hosted model keeps everything local with some accuracy trade-off. We benchmark both on your questions.

Ready to start your Natural Language to SQL Solutions project?

Tell us what you need and we will come back with a clear scope, timeline and the questions worth answering before any build starts.