EXPLORINEER
en

Hatena

I Tried Building a Tool That Auto-Generates Table Definition Docs and ER Diagrams So AI Can Answer Questions About Table Structure

SoftwareFirst seen 98 points


A Japanese developer built a free tool called dbxray. It reads a database and makes table documents and diagrams, and it also lets an AI answer questions about the table structure.

What happened

Takashi Ebina, a developer at Works Human Intelligence, shared a tool called dbxray. It connects to a database and writes Markdown files that describe its tables. It also includes a server (called MCP) so an AI coding assistant such as Claude Code can read those files and answer questions about the tables.

Why the tool was made

The author needed to learn the table layout of a sub-system he did not know well. The system is large and has few documents. He improved an older tool that only wrote table definitions. The new tool makes more kinds of documents and helps an AI understand the tables.

Key facts

  • Latest version described in the article: v0.4.2.
  • Supported databases: PostgreSQL (version 13 or newer recommended) and Oracle (version 12c or newer recommended).
  • Needs Java 21. The download already includes Java, so users do not need to install it.
  • The database password is passed through an environment variable, not the config file, so it is not stored where an AI might read it.

Example questions the AI can answer

  • Find tables related to employees.
  • How do I JOIN a table to get a department name from an audit log?
  • Which places are affected if the employee table changes?
  • Which tables have a structure similar to the employee table?

Why it matters

Many teams have old systems with little documentation. Tools like this can create up-to-date table guides and diagrams automatically. They also give AI assistants accurate table structures, so AI-written code is less likely to use the wrong tables or columns.

Glossary

dbxray
A free tool that writes table documents and diagrams from a database and lets AI read them.
MCP
A way to connect an AI assistant to outside tools or data sources, here the table documents.
Claude Code
An AI coding assistant that can write and edit code.
PostgreSQL
A popular free database system used to store and manage data.