-
Notifications
You must be signed in to change notification settings - Fork 0
SqlExportedLedgerVisualization
title: SQL-Exported Ledger Visualization radar_quadrant: Techniques radar_ring: Assess radar_position: outer
Plain text accounting tools like hledger are deliberately minimal: a ledger is just a text file, and querying it usually means running a command-line report. That minimalism becomes a limitation the moment someone wants an actual chart — spending trends over time, category breakdowns, net worth over months — rather than a text table. This technique, described in a Plain Text Accounting forum thread, bridges the gap by routing the ledger through a real database and a general-purpose visualization tool instead of building custom charting.
The workflow has three steps. First, export the ledger to SQL using hledger's built-in exporter and pipe it directly into a SQLite database file: hledger print -O sql -f main.ledger | sqlite3 sql_ledger.db. Second, keep that database file in a dedicated folder so it can be reused. Third, run Metabase, an open-source analytics tool, in Docker with that folder mounted as a volume, giving it access to the SQLite file as a data source. From there, Metabase's normal query and dashboard-building interface works against ledger data the same way it would against any other database.
The thread's author describes this explicitly as a "low-tech" solution: it requires manually re-running the export whenever the ledger file changes, since there is no automatic sync between the text ledger and the SQLite copy. The value is in reusing a mature visualization tool's charting and dashboard capability instead of writing custom scripts, at the cost of that manual refresh step.
This is placed in Assess, outer position. The technique composes entirely of existing tools — hledger's own exporter, SQLite, and Metabase — so there is nothing new to install or trust beyond wiring them together, which keeps the ceiling on risk low. Outer position reflects the manual-refresh limitation the source itself calls out: without an automated sync step, the visualization drifts out of date as soon as the ledger changes, which limits how far this can go before it needs a scheduling or file-watching layer on top. No first-person run against a real ledger has happened yet, which is the gate to Trial.