2026-11-26 15:39 UTC

Dbprint packages database profiles and annotations for offline coding agents

state: seedheat: mediumuncertainty: mediumrelevance: highdatabase-context agent-toolsJakub Růžička

What is this?

Dbprint is an Apache-2.0 database-context tool by Jakub Roman (GitHub user jakubro), introduced in a Show HN post on 31 October 2026 and documented in its GitHub repository. It generates portable, versionable text snapshots of database schemas, relationships and column-level statistics, alongside human- or agent-written annotations about what the data means. Coding agents can read committed snapshots offline through MCP, CLI context or packaged skills, without database credentials at inference time. The project says it supports several database systems and offers redaction and CI checks. The supplied sources establish the release and describe the implementation, but offer no independent evaluation or adoption evidence.

Why it matters

Dbprint turns database structure and measured data patterns—plus business knowledge that statistics alone cannot reveal—into a reviewable artifact agents can reuse across sessions. That could reduce repeated live exploration and avoid giving agents database credentials, while bringing data context into ordinary code review and CI. Its value depends on keeping snapshots current and handling real cell values carefully: profiling can publish values into a repository unless users configure redaction. The project's claimed accuracy and cost improvements are not independently verified here.

Current assessment

New: the author announced dbprint on Show HN on 31 October 2026; the linked GitHub repository is the originating first-party description. It profiles database structure, relationships and column statistics into versioned text, supports annotations, and exposes committed prints through MCP and other interfaces without connecting agents to the live database. The repository documents adapters for PostgreSQL, MySQL, Snowflake, BigQuery, Databricks, ClickHouse, Redshift and DuckDB; the HN post lists a shorter set, omitting Redshift and DuckDB. The project also describes redaction, CI drift/assertion checks, and offline use. The README claims tests across multiple codebases showed 80% fewer wrong answers and 17% lower cost per correct answer, with 90% fewer errors on questions whose answer appeared only in the print; these are company/author claims, with no benchmark details or independent corroboration in the supplied evidence. Important operational caveat: prints can contain actual database values, so redaction and review matter before committing them. Snapshots can also become stale; the tool provides freshness and drift checks, but evidence here does not establish adoption, production outcomes, or the reliability of inferred relationships and semantic annotations. Its significance is a practical shift toward version-controlled, reusable database context for agents, potentially reducing repeated warehouse queries and credential exposure rather than enabling live querying.

Measured heat

now 0 pts/hpeak 0 pts/hcomments 0/hpeers p10momentum: steady2 platformsage 648h
points/hour across evidence · reading as of 2026-11-27 02:23:58.509736+11:00 · deterministic, not a model opinion

How the heat travelled

10-30 15:26 (minted)⭐ origin echo-reconstructedThe GitHub repository is the originating artifact: it describes dbprint as a tool to “Write down once what your database means, next to your
Jakub Roman (GitHub user jakubro) on github (echo) · attributed from hn.story.50305171 · published time unknown
—
10-30 15:20first on hacker news · published · lag ?Show HN: Dbprint – Database Context for Agents
jakubro
—
10-30 15:20amplified on hacker news 👑hn.story.50305171
jakubro
peak 1 · 0 comments · 103% of case engagement
10-30 15:21our radar first saw it · lag ?discovery anchor: hn.story.50305171—
pace: p11 vs 1845 stories at the 336h mark (now 648h old) — behind adobe-max-ai-agents-creative-tools-mcp (0.5x)

Evidence (2) — ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnShow HN: Dbprint – Database Context for Agents
Retrieved article excerpt

Open article · Retrieved 2026-10-30T15:23:26.899569+00:00

# dbprint

[PyPI](https://pypi.org/project/dbprint/) [Docs](https://jakubro.github.io/dbprint/) [License: Apache 2.0](https://github.com/jakubro/dbprint/blob/main/LICENSE) [Status](https://github.com/jakubro/dbprint) [M8ven Score](https://m8ven.ai/mcp/jakubro-dbprint-1jc05n?s=readme)

**Write down once what your database means, next to your code, and every agent session reads it.**

Your coding agent reads your migrations and your models, so it gets the shape of your database right. What it gets wrong is everything the shape does not say: that `revenue_cents` is gross and every report uses the net column, that `status` is spelled two ways, that `orders` joins `shipments` one-to-many more often than anyone expects, that `legacy_uid` has been dead since the migration. A colleague would tell it in thirty seconds. Without a database connection the agent cannot find out. With one, it rediscovers the same facts live, every session — queries that cost your warehouse time and budget and cost the agent tokens — and can still read them wrong: a count does not say that a code is dead or that a column is gross.

dbprint turns that knowledge into plain text committed in your repository:

- **It measures the database once.** Each table's DDL, its joins — declared, and inferred where the schema declares none — and per-column statistics: null shares, complete value lists with every spelling, ranges, distributions, value shapes and more. On PostgreSQL, MySQL, Snowflake, BigQuery, Databricks, Redshift, ClickHouse or duckdb.
- **An agent writes down what the numbers mean.** `dbprint annotate` hands an agent one table's measurements and the questions they leave open — what a code means, what a sentinel date stands for, which rows a report leaves out — and the agent answers them from your code and read-only queries, into files dbprint never overwrites. `dbprint annotate --check` flags a note the data contradicts.
- **Every later session reads it offline.** Through an MCP server, a packaged skill or `dbprint context`, with no database connection and no credentials at the agent. Because it is text in git, a schema or data change shows up in review, and `dbprint check` gates it in CI.

> **With dbprint, agents get more answers right, for less.** In our tests across multiple codebases, coding agents reading an annotated print got **80% fewer answers wrong** than without one, at **17% lower cost per correct answer** — and **90% fewer** on questions whose catch only the print stated.

## What your agent reads

An excerpt of `dbprint context --purpose query` on a table from [the reference print](https://github.com/jakubro/dbprint/tree/main/docs/format/v1/examples) in this repo — the fragment an agent gets before it writes SQL:

```
# Table: arboretum.seedbank.germination_trial  (900 rows, 8 columns)

## Joins
- accession_id -> arboretum.seedbank.accession.accession_id (declared)
- collector_id -> arboretum.seedbank.collector.collector_id (inferred)

## Data dictionary

One row per germination attempt run against a batch drawn from an accession.

## Column values

| Column | Values (count) | Coverage | Nulls |
|---|---|---|---|
| medium | 'moist filter paper' (176), 'sterile grit' (176), 'vermiculite mix' (176), 'agar medium' (175), 'sand tray' (176) {'sand tray' (151), 'Sand Tray' (25)}, 'control' (21) = 'No growth medium: a no-treatment control group, its germinated_count compared against ambient conditions rather than a physical medium.' | 100% - the list is the whole domain |  |
```

Three things here no migration states: `medium` holds exactly these values and no others, `sand tray` is stored in two spellings, so a filter on one misses 25 rows, and `control` is not a medium at all. The first two dbprint measured; the third a human or an agent wrote down once, and every session after it reads.

Run it yourself, with no database and nothing to configure — only [uv](https://docs.astral.sh/uv/):

```
uvx dbprint context arboretum.seedbank.germination_trial --purpose query \
  --project https://github.com/jakubro/dbprint/blob/main/docs/format/v1/examples/production/.dbprint.yaml
```

## Quickstart

Requires **Python 3.13+**. Install with the driver extra for your database:

```
uv tool install 'dbprint[postgres]'     # or [mysql], [snowflake], [duckdb], [clickhouse], [redshift], [databricks], [bigquery]
```

Add the `[mcp]`, `[docs]` or `[dbt]` extras in the same install — `uv tool install 'dbprint[postgres,mcp]'` — since a later install replaces the earlier one rather than adding to it.

The Postgres adapter shells out to **`pg_dump`** for DDL, so the PostgreSQL client binaries must be on your `PATH`.

Scaffold a project in your repo root:

```
dbprint init
```

That writes `.dbprint.yaml` (commit it), creates `prints/`, and writes a credentials template to `~/.dbprint/connections.yaml` — outside the repo, so secrets never sit next to the config.

Put your connection details in the credentials file:

```
# ~/.dbprint/connections.yaml
primary:
  host: localhost
  port: 5432
  database: my_db
  user: dbprint_ro
  password: change_me
```

and tell `.dbprint.yaml` which adapter to use and which tables to read:

```
# .dbprint.yaml
connections:
  primary:
    adapter: postgres
    auto: true
    tables:
      include:
        - "*.public.*"
```

Credentials resolve from `DBPRINT_<CONNECTION>_<KEY>` environment variables first, then `~/.dbprint/connections.yaml`, then a project-root `.env`. Every key of both files is in [`docs/CONFIG.md`](https://github.com/jakubro/dbprint/blob/main/docs/CONFIG.md).

Profile it:

```
dbprint generate
```

Commit the result alongside your code. Then inspect it with no database in reach:

```
dbprint list
```

Then have an agent annotate a table — the brief carries the [annotation skill](https://github.com/jakubro/dbprint/blob/main/docs/examples/skill/dbprint-annotate.md)'s steps, so any agent CLI can follow it:

```
dbprint annotate my_db.public.orders | claude -p
```

and [connect your agent](https://github.com/jakubro/dbprint#connecting-an-agent) to the result.

## What it does to your database

- **It reads.** A role that can `SELECT` the tables you profile is enough; each engine's adapter page, linked from [your first print](https://jakubro.github.io/dbprint/start/), lists the exact grants. The one write is a temporary copy of a sampled table's drawn rows, gone when the session ends (on BigQuery, when its expiration passes), and only when you sample — [`read.tables.materialize`](https://github.com/jakubro/dbprint/blob/main/docs/CONFIG.md) turns it off.
- **It publishes real values.** Value lists, ranges and percentiles are cell values, and they land in your repository. Nothing is withheld by default: [redaction](https://jakubro.github.io/dbprint/guide/redaction/) masks, drops or hashes them by column name, by detected sensitivity (`personal_name`, `national_id`, ...) or by shape, keeping every count. A password or key written into the schema itself — a view body, a default, a comment — is masked in `ddl.sql` on every run, whatever the rules say.
- **It costs one profiling run, then what you choose to re-run.** A table is re-read when its print is older than its freshness threshold or its settings changed; sampling, row filters and catalog-only reads bound the cost on a warehouse — see [choosing what to profile](https://jakubro.github.io/dbprint/guide/scoping/).

## What a print looks like

Under the context an agent reads are plain YAML files. An excerpt of one table's `statistics.yaml`, some fields elided, from the same reference print:

```
row_count: 2500
columns:
  catalogue_url:
    sql_type: character varying(200)
    nullable: false
    null_rate: 0.0
    classification: text
    cardinality: 2500
    cardinality_ratio: 1.0
    inferred:
      looks_like: url
      sampled: 1000
      matched: 1000
      candidate_key: true
    values:
    - value: https://specimens.example.org/accession/1
      count: 1
    - value: https://specimens.example.org/accession/10
      count: 1
    # ... 28 more
    values_coverage: 0.012      # top 30 of 2500 - a value list, not a claim of completeness
    distribution: long_tail

  provenance_country:
    sql_type: character(2)
    classification: categorical
    cardinality: 10
    inferred:
      looks_like: country_code
      sampled: 10
      matched: 10
    values:
    - value: AU
      count: 250
    - value: CA
      count: 250
    - value: DE
      count: 250
    - value: FR
      count: 250
    - value: GB
      count: 250
    # ... 5 more
    values_coverage: 1.0        # the list is the whole domain, not a sample
    distribution: uniform

  received_at:
    sql_type: timestamp(0) with time zone
    classification: temporal
    range:
      min: '2018-01-08T00:00:00Z'
      max: '2024-11-28T00:00:00Z'
      span_days: 2516
    percentiles:
      p01: '2018-02-09T00:00:00Z'
      p25: '2019-10-02T00:00:00Z'
      p50: '2021-06-19T00:00:00Z'
      p75: '2023-03-05T00:00:00Z'
      p99: '2024-10-25T00:00:00Z'
```

`values_coverage: 1.0` is the load-bearing field: those ten values are the *entire* domain, not the top ten. An eleventh value can be ruled out without asking the database. (When a table is profiled from a sample rather than in full, coverage is measured over the rows that were actually read — see [Scoped profiling](https://github.com/jakubro/dbprint#beyond-the-basics) below.)

`inferred` is what dbprint concluded rather than read: `looks_like: country_code` is a verdict, and `sampled`/`matched` are the evidence for it, so a shape confirmed by ten values never looks like one confirmed by ten thousand.

Alongside it, `relationships.yaml` carries the join graph:

```
refers_to:
- column:
  - collector_id
  target_table: arboretum.seedbank.collector
  target_column:
  - collector_id
  on_delete: RESTRICT
  detection: declared      # or `inferred`, when dbprint guessed the edge from naming
  observed:
    fanout_avg: 6.25
    target_coverage: 1.0
```

That half is measured. The other half you write, in the same directory, in the same commit — `statistics.annotations.yaml` for a column:

```
columns:
  collector_id:
    note: >-
      FK to collector.collector_id. Field collectors are affiliated with a
      partner institution; collector.institution names it.
```

and `description.md` for table-level narrative that no statistic can express.

dbprint never writes to either file, and both are read alongside the statistics — but on anything the statistics can answer, the statistics win; the narrative is authoritative only on what a number can't.

## What lands in your repo

```
prints/<connection>/
  manifest.yaml                    # inventory, freshness, per-table thresholds
  reading.md                       # generated guide - how to read the rest of the print
  diff.yaml                        # machine-readable drift from the last run
  manifest.annotations.yaml        # optional, connection-level notes you write
  <namespace>/<table>/             # one directory per FQN segment, e.g. arboretum/seedbank/accession/
    ddl.sql                        # native DDL, normalized for stable diffs
    statistics.yaml                # column distributions
    relationships.yaml             # declared + inferred foreign keys
    description.md                 # optional, you write it
    statistics.annotations.yaml    # optional, per-column notes you write
    relationships.annotations.yaml # optional, per-edge notes you write
```

`reading.md` is written fresh on every run: it teaches a consumer which fields to trust for what, so a print explains itself to an agent that has never seen the format.

The four `.md` / `.annotations.yaml` files are yours — dbprint never overwrites them, and all four are folded into what agents read.

## Commands

| Command | What it does |
| --- | --- |
| `dbprint init` | Scaffold `.dbprint.yaml` + `prints/` + a credentials template |
| `dbprint config explain` | Print the profile one table r
jakubro10
🟧 echo.github ⭐The GitHub repository is the originating artifact: it describes dbprint as a tool to “Write down once what your database means, next to yourJakub Roman (GitHub user jakubro)——

Interpretation history

Decision trace