SuperAPIAI Directory

dbprint

github.com · Other AI tools

dbprint is a tool that writes database structure and column-level data distribution measurements as plain-text snapshots, committed to Git alongside code, for offline reading by people, AI coding agents, and CI. It supports PostgreSQL, MySQL, Snowflake, BigQuery, Databricks, Redshift, ClickHouse, duckdb, and SQLite, and can output each table's DDL, join relationships, and column statistics (null ratio, complete value lists, ranges, distributions, value shapes, etc.), and allows people or agents to supplement numeric meanings in separate annotation files. Agents can read offline via the MCP server, Markdown skills, or the dbprint context command, without database connections or credentials.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

Purpose

dbprint solves the problem that migration files and models record only database structure, not data meaning. For example, whether a column is gross or net revenue, how many spellings a status code has, the frequency of one-to-many relationships between orders and shipments, or that a legacy field has not been used since a migration. Agents without a database connection cannot learn this information; agents with a connection must repeat queries in every session, consuming repository time, budget, and tokens, and may still misread results. dbprint measures the database once and writes a plain-text snapshot that can be committed to Git for later offline reading.

Key capabilities

  • Measure the database: output each table's DDL, join relationships (declared, and inferred when not declared in the schema), and column-level statistics, including null ratio, complete value lists with all spellings, ranges, distributions, value shapes, etc. Supports PostgreSQL, MySQL, Snowflake, BigQuery, Databricks, Redshift, ClickHouse, duckdb, SQLite.
  • Annotations:dbprint annotate hand a table's measurement results and open questions to an agent; the agent answers based on project code and read-only queries and writes to files that dbprint will not overwrite;dbprint annotate --check can flag annotations that contradict the data.
  • Offline reading: read via the MCP server, packaged skills, or dbprint context , without a database connection and without credentials for the agent. Because it is text in Git, schema or data changes are visible in review,dbprint check can gate in CI.
  • Semantic inference: classify each column (categorical, numeric, temporal, foreign_key_candidate, json, etc.); text, categorical, and foreign key columns are matched against closed shape patterns (uuid, email, phone, ip, country_code, etc.), with sample size and match counts published; sensitive data columns carry sensitivity axes (personal_name, postal_address, national_id, credential, etc.); near-unique columns are marked candidate_key; undeclared foreign keys can be inferred from naming and detection timestamps.
  • Redaction: apply mask, drop, or salted hash to cell values by column-name glob, inferred sensitivity, or shape; counts, cardinality, and distributions are preserved, only literal values are hidden. The salt is stored with credentials and does not enter the committed configuration.
  • Assertions: write data quality checks in YAML against any statistic or raw SQL; statistical assertions are evaluated by plain dbprint check against the committed snapshot, without a database; SQL assertions require dbprint check --online.
  • CI exit codes: 0 normal, 1 snapshot format error or unusable configuration, 2 stale, 3 drift, 4 connection failure, 5 partial run, 6 assertion failure, 7 complete failure.diff、check、context all support --format json|yaml.
  • Scoped profiling: set sampling per table (seeded by table name where the engine supports it), row filters, or change what is measured, and set thresholds by table size; such tables carry a scope block and per-column rows_scanned, and all counts use the actual number of rows read as the denominator.
  • MCP server:dbprint serve Provides tools such as get_table_context, list_tables, search_columns, resolve_value, get_manifest, get_diff, get_reference, and exposes each artifact as a resource; reads only committed snapshots and never opens a database connection.
  • Markdown skills: For clients that accept Markdown rules or custom instructions, provides plug-and-play skill files explaining what committed snapshots can answer, which tool answers, and what each number covers; another skill lets the agent generate annotation files from the code that writes tables and read-only queries, and use dbprint annotate --check to check.
  • dbt lineage: Point the connected dbt_manifest at the compiled dbt manifest.json to record derived_from source columns for each model column, so annotations written on source columns propagate to all models built from them (requires the [dbt] extra dependency).
  • Token-budget context:dbprint context arboretum.seedbank.accession --budget 4000 adapts Markdown views to a token budget, dropping lower-priority sections first.

Usage

Requires Python 3.13+. Install driver extras per database engine, e.g. uv tool install 'dbprint[postgres,mcp]', or 'dbprint[all]' to install all extras; later installs replace earlier ones. The PostgreSQL adapter calls pg_dump to obtain DDL, so the PostgreSQL client binaries must be on PATH.

Initialize the project at the repository root: write .dbprint.yaml(commit it), create prints/, and write the credentials template to ~/.dbprint/connections.yaml(outside the repository, to avoid keeping secrets alongside configuration). Fill in the connection information in the credentials file, and specify the adapter and the tables to read in .dbprint.yaml . Credential resolution order is:DBPRINT_<CONNECTION>_<KEY> environment variable,~/.dbprint/connections.yaml, project root .env.

After committing the results, you can check them without a database environment. When asking the agent to annotate a table, the task description carries the steps of the annotation skill, which any agent CLI can follow. Connecting an agent: in Claude Code, install the plugin (which carries the MCP server and two skills, serving the snapshot of the directory Claude Code opens); other MCP clients start the server themselves and must explicitly specify the project. The server reads only committed snapshots and never connects to the database, so clients need no credentials.

--project also accepts git addresses, allowing direct reading of snapshots committed to another repository without manual cloning; private repositories are handled by the existing SSH agent or git credential helper. Remote projects are read-only: all commands that connect to the database (generate, diff, check, and the --online forms of config explain) reject remote locators, while the remaining commands behave the same as for local projects.

When to use

Suited to teams that want AI coding agents to accurately understand database structure and the meaning of data distributions without a database connection or credentials; suited to workflows that bring database snapshots into code review and CI gates; suited to scenarios that need to reuse measurement results across sessions and reduce repository query costs and token consumption.

Limitations

  • Not a migration tool: does not write, apply, or version DDL changes.
  • Not a schema management or ORM layer: snapshots are generated from the database and are never the source of truth from which the database is built.
  • Not a live query interface: nothing in the snapshot executes SQL for the agent.
  • Not a data quality platform: the assertion DSL is a CI gate over snapshots, not monitoring, alerting, or lineage.
  • Not a data catalog: no hosted service, shared search index, or business glossary;dbprint docs Only provides a local read-only view bound to the loopback address.
  • Publishes real values: value lists, ranges, and percentiles are cell values and are committed to the repository; by default nothing is retained and must be handled by masking rules based on column name, sensitivity, or form.
  • Cost: one profiling run, then re-reads based on freshness thresholds or setting changes; sampling, row filtering, and catalog-only reads can limit repository cost.
  • Remote projects are read-only; commands that connect to the database are unavailable.
  • Specific fees, pricing, platform availability, and other information have not yet been provided.
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools