Resources / Insights

AI on Top of Your Existing Data: The Pitfalls, and the Architecture You Need

Diagram comparing two paths for the same plain English question, monthly revenue by region. Against raw data sprawl with fourteen order tables, three revenue columns, and no documentation, the AI still writes valid SQL and returns a confident wrong number. Against curated data with a documented schema and one governed definition of revenue, the same AI drafts the right query and returns a number you can trust. The model was the same in both paths, the data was not.

Every AI pitch this year lands on the same promise: put AI on top of the data you already have. Point a model at your warehouse, ask questions in plain English, get reports in minutes. The demo is real, and I will not argue against it, because we build exactly this. What the demo hides is that everything hard lives underneath it: what the model is allowed to read, what its query is allowed to do, and who is allowed to see the result. Get that architecture right and the demo becomes infrastructure. Skip it and you get the new failure mode of enterprise reporting.

Here is what that failure mode looks like. You ask an AI for monthly revenue by region. It scans your schema, finds a table named orders_v2_final and a column named rev_amt, and writes a query that parses, runs, and returns a clean bar chart. Nothing errors. The number is wrong anyway, because rev_amt holds gross bookings before refunds, and your finance team defines revenue net of refunds. Nobody files a bug, because nothing looks broken. The old failure was a report that never arrived. The new failure is a wrong number that arrives instantly, nicely formatted, with total confidence.

Before Dittah I led a global enterprise reporting team, and after that data strategy, so I have seen this from both sides. Most companies have three tables that could plausibly be called orders, at least two columns that could plausibly be revenue, and a graveyard of datasets nobody has touched since the analyst who built them left. People navigate that mess on tribal knowledge. A model has no tribe. It has whatever you show it.

So this article walks the pitfalls in the order you will hit them: what goes wrong when data is not curated for AI, how customer data stays out of prompts, what must be verified before any SQL executes, and who gets to see what. If you have one minute, the key takeaways are at the end.

What happens when the data is not curated for AI

Start with the failures themselves, because they show what curation actually means in practice. None of them is fixed by a smarter model. Every one is fixed by a table.

The ask Against raw tables With the curated rule
Monthly revenue by region Picks rev_amt, which is gross bookings before refunds. Confident wrong number Reads the governed metric: revenue means net of refunds, defined once for everyone
High-net-worth customers by branch Invents a balance threshold. Valid query, wrong cohort Joins the configured banding table. Finance moves the cutoff in config, the frozen query picks it up
Total transactions in US dollars Writes WHERE currency = 'USD' and silently drops every row spelled $ or "US Dollars". Undercounts Joins the crosswalk table, so all four spellings map to one canonical code

The first row is the story this article opened with, and its fix, the governed metric definition, comes back in the curation stack below. The other two rows are the rules financial data actually runs on, and they deserve a closer look.

Configured ranges. A bank does not store "high-net-worth" anywhere. It stores balances, and a rule somewhere says which balances count: zero to ten thousand is retail, ten thousand to a million is affluent, above a million is high-net-worth. Ask an AI for high-net-worth customers by branch against raw tables and it does the only thing it can: it invents a threshold. The query is valid, the cohort is wrong, and the chart looks fine. The fix is to keep the ranges in a governed configuration table and say so in the schema documentation, so the drafted query joins the banding table instead of hardcoding a guess. This pays off twice. The rule itself is safe to show a model, since "high-net-worth means the balance falls in the configured band" contains no customer data. And when finance moves the cutoff from one million to two, nobody re-drafts anything: the frozen query reads the ranges at run time, so the code stays frozen while the business changes its mind. Volatile rules belong in configuration. Stable logic belongs in frozen SQL.

Crosswalks. The second kind of rule exists because the same fact arrives spelled differently. One source system writes USD, another writes $, a legacy load wrote "US Dollars", and a spreadsheet import wrote "Dollar". They all mean the same thing, and nothing in the schema says so. Now watch what a model does with "total transactions in US dollars". It writes WHERE currency = 'USD', the query runs, and every row that says $ or "US Dollars" silently falls out of the total. The report undercounts, which is the worst kind of wrong, because an undercount does not look broken to anyone. The cure is a crosswalk table: every observed variant mapped to one canonical code, maintained as reference data, with queries joining through it. Ideally values get standardized before they ever land in the warehouse, and your ingestion pipeline should try. In practice you do not control every producing system, the legacy rows predate the standard, and new sources keep arriving. The crosswalk is the compensating control for the world as it actually is. Curate it once, tell the model it exists, and the drafted query catches all four spellings.

Both patterns share the property that everything else in this design turns on: they let the model draft a correct query by reading rules about the data instead of the data itself.

Security: how PII stays out of the prompt

The question I hear from financial services teams is rarely whether AI can write the query. It is "how do you guarantee customer data is not in the prompt?" Guarantee is the right word to insist on, because a policy document is not a mechanism. The starting point is the observation above, taken seriously as an architecture: to draft a query, a model needs structure and rules. Schema, descriptions, metric definitions, banding logic, crosswalks. It never needs a real row. Here is the whole contract on one screen, for the bank example we just built:

What crosses the boundary, and what never does SENT TO THE MODEL AT DESIGN TIME • Schema and column descriptions • Governed metric definitions • Banding rules and crosswalk logic • Masked or synthetic sample rows NEVER SENT • Real customer rows • PII values, even as examples • Credentials and connection strings • Live production data at runtime WHAT COMES BACK SELECT b.label, SUM(t.amount) FROM transactions t JOIN currency_xwalk cw ON t.currency = cw.variant JOIN balance_bands b ON t.balance BETWEEN b.lo AND b.hi WHERE cw.canonical = :currency GROUP BY b.label Joins through the crosswalk and the configured bands. Placeholders, not literals. freeze AT RUNTIME, INSIDE YOUR NETWORK Frozen code binds real values and reads live config Change the HNW cutoff in config and the same frozen query picks it up. No model in the loop. The draft contains structure and placeholders.  Not one real value.

The left half of that picture does not happen by good intentions. Four layers enforce it.

For some institutions even the schema is sensitive, and researchers have shown that table and column names alone can leak business structure. For that case the design step runs against a local model, so nothing leaves your network at all. We covered when that trade is worth it in keeping sensitive data out of third-party LLMs.

One more thing in the diagram deserves a hard look: the WHERE clause carries a placeholder, not a value. Parameters are bound by the execution engine at run time, never concatenated into the SQL string. That one decision serves two masters at once. It is the privacy mechanism, because real values stay out of the draft and out of every prompt. And it is the classic defense against SQL injection, because a bound parameter is data, never executable SQL. If a user-supplied value ever reaches a frozen report, it arrives through a typed parameter or it does not arrive at all.

Verify before you freeze

Review is a person reading the draft. Verification is the guardrail layer: what the platform checks mechanically before the draft is even allowed into review, and it answers the question every CISO asks about AI guardrails: what gets validated before the SQL actually executes. The list is short and boring on purpose.

None of this is exotic. It is the hygiene database teams have applied to human-written SQL for decades, applied at the one gate every AI-drafted query already passes through. That is the quiet advantage of the freeze step: it gives all of these checks a single place to live.

The curation stack underneath

Rules, safe exposure, and verification all sit on data that has to be sound underneath. Four practices do most of that work, plus one honest caveat about data that lives everywhere.

And the caveat: most enterprises do not have one warehouse. Data sits in a warehouse, three SaaS platforms, and a folder of files, and every practice above multiplies, because each source has its own permission model, its own spellings, and the join has to physically happen somewhere. Federation deserves its own article, but the short version follows the same design: curate and certify per source, and let frozen code do the joining inside your boundary instead of shipping data out to a model to reconcile.

The curation stack behind a right answer What you curate is what the model reads. The stack feeds design time, and only design time. WHAT YOU CURATE SEMANTIC LAYER + RULES Governed metrics, bands, crosswalks DOCUMENTED SCHEMA Column descriptions, certified datasets QUALITY SIGNALS Tests, freshness, contracts with owners SAFE SAMPLES PII tagged, rows masked or synthetic DESIGN TIME AI drafts the query The model reads curated context, not raw sprawl. THEN, AND ONLY THEN Verified, reviewed, then frozen to code Deterministic runtime The same query, the same number, on every run The model sees metadata and masked samples only.  Production data stays behind your boundary.

Curation is what makes the review meaningful

In Build Studio, the model drafts the query and the visualization at design time, and a person reads both before anything is frozen. I want to be honest about what that review can and cannot catch. A reviewer can only spot the gross-versus-net mistake if a governed definition of revenue exists to check the draft against, and can only confirm the crosswalk join if the crosswalk exists. On a curated warehouse, review is a two-minute confirmation. On raw sprawl, it is archaeology, and archaeology under deadline pressure gets skipped.

Curation pays off again after the freeze. The frozen code runs deterministically, and Ops Hub watches every run, so an empty result or an anomalous total is surfaced instead of delivered. Failures stay loud all the way to production: we walked a finance example end to end in a regulated report, automated end to end. And because the model never runs at runtime, a badly modeled warehouse cannot cause a new wrong answer on Tuesday that did not exist on Monday. The failure surface is the code you reviewed, not a model that drifted.

Permissions: who is asking?

Everything above governs what the model may read and what the code may run. Production systems have a second identity problem, and it deserves more than a paragraph. The builder's permissions should scope what schema and samples the model sees at design time. The viewer's permissions should scope what a report returns at run time, so a branch manager and a group CFO run the same frozen query and see different rows. Getting entitlements baked into AI-built workflows, consistently, across sources that each have their own permission model, is the subject of the next article in this series. It will also pick up the piece of the privacy story deferred here: what happens when someone asks an ad-hoc question about one specific customer, and the lookup has to resolve without the customer's identity ever entering a prompt.

Where to start, without a two-year program

Data curation sounds like a boil-the-ocean initiative, which is why it usually loses to a flashy pilot. It does not have to be one. It does need an owner: who can publish a certified dataset, who signs a change to the definition of revenue or to a banding range, how a dataset earns and loses certification. Settle that up front, or the stack rots back into sprawl. Then run a sequence like this:

  1. Pick the twenty tables behind your most-used reports and write real descriptions for them, table by table, column by column.
  2. Classify every column in those tables as public, internal, or PII. Deny-by-default exposure only works if the tags exist.
  3. Define your five most contested metrics once. Revenue, active customer, churn, margin, whatever gets argued about in meetings. Get finance to sign the definitions.
  4. Move volatile rules into configuration, and build crosswalks for your five messiest value sets. Currency, country, product codes: wherever the same fact has four spellings.
  5. Hide what you cannot vouch for. Deprecated tables and abandoned copies leave the model's view entirely.
  6. Route every model-bound prompt through one gateway, with PII scanning and a full audit log.
  7. Add freshness and volume checks on those twenty tables, so staleness becomes loud.

That is a few weeks of focused work, not a program with a steering committee. And every hour of it also improves your human analytics, because the analysts have been navigating the same sprawl the model is now lost in.

Key takeaways

AI made writing queries cheap. It did nothing to make your data mean something. Curate the data, expose it through one guarded gate, verify every draft before it freezes, and AI on top of your existing data becomes what the demos promise. Skip that work, and you will simply produce confident garbage faster than you ever have.

If you want to see what the model does with a well-described schema, build your first workflow against a report you already know, or download the free Community edition and point it at your own warehouse, on your own servers.

Back to Resources