cd /news/ai-tools/glancer-ask-your-rails-database-ques… · home topics ai-tools article
[ARTICLE · art-15566] src=dev.to pub= topic=ai-tools verified=true sentiment=↑ positive

🇺🇸 Glancer — Ask your Rails database questions in plain language

A developer has released Glancer, a Ruby on Rails engine that lets users query databases using natural language instead of writing SQL. The tool mounts a chat interface at `/glancer` within Rails apps, using RAG and LLMs to generate and safely execute SELECT queries while returning results with plain-language explanations. Glancer runs queries inside rollback transactions, supports multiple LLM providers including Gemini and OpenAI, and stores embeddings as JSON columns in the existing database with no extra infrastructure required.

read3 min publishedMay 27, 2026

A Rails engine that allows you to query the database using natural language, with RAG and LLMs. No need to write any code.

Every Rails project reaches a point where someone on the team (product, support, management) needs data, but no one has time to write a quick query for them. You know the drill: a Slack message, a GitHub issue titled "how many users signed up last week?", or a CSV request that ends up in someone's backlog.

So, I think about Glancer.

Glancer is a Ruby on Rails engine that mounts a full chat interface at /glancer

inside your app. You type a question in plain language, it retrieves the relevant schema context, generates a SELECT

query (or an ActiveRecord expression), validates and executes it safely, then returns the result with a human-readable explanation.

"How many orders were placed in the last 30 days, grouped by status?"
→ SELECT executed, results shown, answer written in plain language.

It is inspired by Blazer, but instead of writing SQL yourself, you just ask.

Add it to your Gemfile

:

gem "glancer"

Run the generator:

rails generate glancer:install
rails db:migrate
rails glancer:index:all

Then visit /glancer

and start asking questions.

The generator creates an initializer where you configure your LLM provider. A minimal setup with Gemini looks like this:

Glancer.configure do |config|
  config.llm_provider   = :gemini
  config.llm_model      = "gemini-2.0-flash"
  config.gemini_api_key = ENV["GEMINI_API_KEY"]

  config.schema_permission = true
end

OpenAI and OpenRouter are also supported. It runs on top of RubyLLM, so any model it supports works here too. You can assign different models per role: a smarter model for query generation, a cheaper one for writing the response.

A few things worth knowing:

Safety is not optional. Every query runs inside a transaction that always rolls back. The keyword blocklist rejects DELETE

, UPDATE

, INSERT

, DROP

, and friends before they even touch the executor. You can also point it at a read-only replica.

No extra infrastructure. Embeddings live in your existing database as a JSON column. No Pinecone, no Weaviate, nothing to set up.

It understands your domain. You can drop a Markdown file at config/glancer/llm_context.glancer.md

and teach Glancer your business rules — what status

values mean, how revenue is calculated, which columns to ignore:

- `orders.status` values: "pending" | "paid" | "shipped" | "refunded"
- Monthly revenue = SUM(orders.total) WHERE status = "paid"
- When asked about "churn", use the `churned_at` column on `subscriptions`

The UI has some nice touches. Results render in a table with one-click CSV export. Charts are auto-generated where they make sense. Queries run in a background thread, so the main app thread stays free. You can type @table_name

to pin a specific table to your question, edit the generated SQL inline and re-run it, and even dictate questions via microphone. There is also a schema viewer at /glancer/db-schema

.

Blazer integration. If you already have Blazer installed, Glancer shows a button to open the generated SQL there directly.

This started as a study project. I had never published a gem before and wanted to understand the full process, from engine internals to gemspec to CI. I shared it with a few colleagues and they actually found it useful, so I decided to put it out there for the community.

It is version 1.0.0.

If you try it, I would love to hear what you think, about the code or the idea itself. Issues and pull requests are open.

If you find it useful, a star on the repo goes a long way in helping more people discover it.

GitHub: https://github.com/ErnaneJ/glancer

RubyGems: https://rubygems.org/gems/glancer

── more in #ai-tools 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/glancer-ask-your-rai…] indexed:0 read:3min 2026-05-27 ·