{"slug": "glancer-ask-your-rails-database-questions-in-plain-language", "title": "🇺🇸 Glancer — Ask your Rails database questions in plain language", "summary": "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.", "body_md": "A Rails engine that allows you to query the database using natural language, with RAG and LLMs. No need to write any code.\n\nEvery 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.\n\nSo, I think about **Glancer**.\n\nGlancer is a Ruby on Rails engine that mounts a full chat interface at `/glancer`\n\ninside your app. You type a question in plain language, it retrieves the relevant schema context, generates a `SELECT`\n\nquery (or an ActiveRecord expression), validates and executes it safely, then returns the result with a human-readable explanation.\n\n```\n\"How many orders were placed in the last 30 days, grouped by status?\"\n→ SELECT executed, results shown, answer written in plain language.\n```\n\nIt is inspired by [Blazer](https://github.com/ankane/blazer), but instead of writing SQL yourself, you just ask.\n\nAdd it to your `Gemfile`\n\n:\n\n```\ngem \"glancer\"\n```\n\nRun the generator:\n\n```\nrails generate glancer:install\nrails db:migrate\nrails glancer:index:all\n```\n\nThen visit `/glancer`\n\nand start asking questions.\n\nThe generator creates an initializer where you configure your LLM provider. A minimal setup with Gemini looks like this:\n\n```\nGlancer.configure do |config|\n  config.llm_provider   = :gemini\n  config.llm_model      = \"gemini-2.0-flash\"\n  config.gemini_api_key = ENV[\"GEMINI_API_KEY\"]\n\n  config.schema_permission = true\nend\n```\n\nOpenAI and OpenRouter are also supported. It runs on top of [RubyLLM](https://rubyllm.com/), 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.\n\nA few things worth knowing:\n\n**Safety is not optional.** Every query runs inside a transaction that always rolls back. The keyword blocklist rejects `DELETE`\n\n, `UPDATE`\n\n, `INSERT`\n\n, `DROP`\n\n, and friends before they even touch the executor. You can also point it at a read-only replica.\n\n**No extra infrastructure.** Embeddings live in your existing database as a JSON column. No Pinecone, no Weaviate, nothing to set up.\n\n**It understands your domain.** You can drop a Markdown file at `config/glancer/llm_context.glancer.md`\n\nand teach Glancer your business rules — what `status`\n\nvalues mean, how revenue is calculated, which columns to ignore:\n\n```\n- `orders.status` values: \"pending\" | \"paid\" | \"shipped\" | \"refunded\"\n- Monthly revenue = SUM(orders.total) WHERE status = \"paid\"\n- When asked about \"churn\", use the `churned_at` column on `subscriptions`\n```\n\n**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`\n\nto 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`\n\n.\n\n**Blazer integration.** If you already have Blazer installed, Glancer shows a button to open the generated SQL there directly.\n\nThis 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.\n\nIt is version 1.0.0.\n\nIf you try it, I would love to hear what you think, about the code or the idea itself. Issues and pull requests are open.\n\nIf you find it useful, a star on the repo goes a long way in helping more people discover it.\n\n**GitHub:** [https://github.com/ErnaneJ/glancer](https://github.com/ErnaneJ/glancer)\n\n**RubyGems:** [https://rubygems.org/gems/glancer](https://rubygems.org/gems/glancer)", "url": "https://wpnews.pro/news/glancer-ask-your-rails-database-questions-in-plain-language", "canonical_source": "https://dev.to/videosdeti/glancer-ask-your-rails-database-questions-in-plain-language-f8o", "published_at": "2026-05-27 17:11:10+00:00", "updated_at": "2026-05-27 17:41:38.361662+00:00", "lang": "en", "topics": ["ai-tools", "natural-language-processing", "large-language-models", "generative-ai", "ai-products"], "entities": ["Glancer", "Ruby on Rails", "Blazer", "Gemini", "GitHub"], "alternates": {"html": "https://wpnews.pro/news/glancer-ask-your-rails-database-questions-in-plain-language", "markdown": "https://wpnews.pro/news/glancer-ask-your-rails-database-questions-in-plain-language.md", "text": "https://wpnews.pro/news/glancer-ask-your-rails-database-questions-in-plain-language.txt", "jsonld": "https://wpnews.pro/news/glancer-ask-your-rails-database-questions-in-plain-language.jsonld"}}