JAlcocerTech E-books

From the Field: Real Data Stacks I Built

The chapters before this one are the map. This one is the territory: three setups I actually built, with what went into each and what I’d keep. Every section links to the full write-up on the blog, with the code.


1. Plug-and-play analytics: an LLM in front of PostgreSQL

The problem. Business users had questions and no SQL. Every one-off question became a ticket, and every ticket became a dashboard nobody opened twice.

The build. It started as chatting with pandas dataframes and grew into LangChain connected straight to a database:

  1. PostgreSQL in a container, loaded with sample databases that already have their tables in place: Chinook first (moved over from an earlier MySQL version), then Northwind.
  2. A read-only user for the LLM. The model writes SQL; it never gets a connection that can change anything.
  3. The schema is pulled and handed to the model as context. The same schema also renders as a Mermaid ER diagram, which helps humans as much as the model.
  4. A thin UI on top, so the person asking never sees a notebook.

OLTP vs OLAP, for real. Northwind is a classic OLTP database: built for day-to-day CRUD, not for history. Pointing a question-answering agent at it works for “what did customer X order?” and falls apart for “how did margin move per quarter?”. The next step in the series was an OLAP shape for exactly that reason. This is the warehouse vs operational store trade-off, felt directly.

What I’d keep:

  • The read-only user. Non-negotiable.
  • Sample databases you can rebuild from a script. You’ll reset them often.
  • The schema as a first-class artefact: diagram it, version it, feed it.

2. Generative BI: the semantic layer is the product

The question. If an agent can answer from the real contents of a database, can it also choose the right chart? Why are we still building dashboards for one-off questions?

What I tried first. Self-hostable GenBI tools, for inspiration:

ToolWhat stood out
RillBI-as-code: a SQL modeller, a real-time database and metrics dashboards in one product.
WrenAIA modelling layer over the raw schema (relationships, semantics, calculations) so the model lines up with business logic. Runs locally as a handful of containers (UI, AI service, engine, Qdrant).
VannaText-to-SQL you embed in your own app.

What I built. A custom PostgreSQL GenBI, with BAML giving the model typed outputs (query, chart type, fields) instead of free text that has to be parsed.

The lesson. WrenAI made it obvious: the hard part isn’t the LLM, it’s the semantic model. Which table holds “revenue”? Which join is the right one? Is “active customer” 30 or 90 days? That is data modelling and governance work, and no prompt replaces it.


3. A self-hosted D&A toolbox, licences checked

From Self-Hosted Data Analytics. Data work is more about semantics than you’d expect, but you still need the tools. Before standardising a team on one, check what the licence lets you do:

ToolLicenceNote
DBeaver CommunityApacheThe most power for free. NoSQL and cloud integrations are in the paid edition.
HeidiSQLGPLSimple, fully free (Windows).
Beekeeper Studio CommunityGPLTeam workspaces are in the paid edition.
MySQL WorkbenchGPL
TablePlusProprietaryFree trial capped at two tabs.
DataGripProprietaryFree for non-commercial use only.
Power BI DesktopProprietaryFree to use, closed source.

Two names that get mixed up in meetings:

  • Apache DevLake: analytics about your delivery (DORA metrics such as deployment frequency). It measures the team.
  • Delta Lake: a storage layer for data lakes. It holds the data. See Data Lakes.

Whatever the stack (Power BI + DBeaver + MSSQL, or Grafana + PySpark + Elasticsearch), the first query on an unfamiliar database is the same:

SELECT TOP 10 * FROM INFORMATION_SCHEMA.TABLES;

Patterns across all three

  1. Least privilege first. Read-only users for anything automated or AI-driven.
  2. Semantics before tooling. Every build got better when the meaning of the data was written down, and none got better from a new tool alone.
  3. Containers for everything. Each stack comes up and goes down with one compose file, so trying a new tool costs an afternoon.
  4. Enable the people, not only the system. The GenBI work came with one session for big-data communities and one for business users, who saw a working Q&A tool built in under an hour.

For how these projects were scoped and delivered, see Managing Data Projects, which has its own field notes chapter.