惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
有赞技术团队
有赞技术团队
宝玉的分享
宝玉的分享
雷峰网
雷峰网
Hugging Face - Blog
Hugging Face - Blog
V
V2EX
大猫的无限游戏
大猫的无限游戏
博客园 - 司徒正美
D
Docker
T
The Blog of Author Tim Ferriss
罗磊的独立博客
博客园 - 叶小钗
酷 壳 – CoolShell
酷 壳 – CoolShell
Blog — PlanetScale
Blog — PlanetScale
月光博客
月光博客
J
Java Code Geeks
Jina AI
Jina AI
博客园 - 【当耐特】
C
Check Point Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
腾讯CDC
Last Week in AI
Last Week in AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Visual Studio Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
🇺🇸 Glancer — Ask your Rails database questions in plain l...
Ernane Ferreira · 2026-05-28 · via DEV Community

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.

Demo

What it is

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.

Getting started

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.

What it can do

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.

The story behind it

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