Giving good context · for data analysts
Giving good context in data analysis
A model can write fluent SQL, but it has never seen your warehouse. It does not know that the orders table holds one row per line item. It does not know that refunds sit in a separate table, or that a status of 4 means canceled. Without those facts, it writes correct syntax over wrong assumptions.
Giving good context means handing the model what a new analyst would need on day one. That includes table schemas, a few sample rows, the agreed metric definitions, and the known problems in the data. It also means removing anything sensitive before it leaves your environment.
Where it comes up
Joining tables you rarely use
Paste the column names, types, and primary keys for each table, and state the grain of each one. Grain is the fact the model most often gets wrong when it guesses.
Cleaning a messy export
Show a small sample of the actual messy values, such as the different ways a country is spelled, rather than describing them. State which values are valid and what to do with the rest.
Matching an existing dashboard
Give the model the dashboard’s metric definition and filters. A new query that uses a different definition will disagree with the dashboard, and someone will ask why.
What it looks like at each band
E1 · Foundational
Names the tables and describes the goal. The model fills in column names and relationships by guessing, and queries often fail or return the wrong grain. Does not yet see the missing schema as the cause.
E2 · Proficient
Pastes the relevant schema and a few sample rows. States the metric definitions the team uses. Output usually runs on the first try and matches the intended grain.
E3 · Distinguished
Chooses context for each task. Includes known quirks, such as duplicate events or a backfill that changed history, and leaves out tables that would mislead. Replaces real values in sample rows with realistic fakes when the data is sensitive.
E4 · Exceptional
Maintains the shared context the team works from: a data dictionary written for AI use, certified metric definitions, and a list of known data issues. Updates that material when the schema changes, before it causes errors.
Common mistakes
Describing the schema from memory
Column names drift and memory is imprecise. Copy the schema from the warehouse so the model works from what exists.
Omitting the grain
If the model does not know a table holds one row per event, per user, or per day, it will count and join wrongly. State the grain for every table you include.
Pasting real rows to show the format
Sample rows often contain names, emails, or account numbers. A few rows with fake values show the format equally well.
A worked example
Calculating average order value by region for a quarterly review.
Our orders are in the orders table. Write a query for average order value by region last quarter.
The model does not know that orders holds one row per line item, that region lives on the customers table, or that refunds are stored elsewhere. The query will run and overstate the number of orders.
Tables: orders (one row per line item; order_id repeats; columns below), customers (one row per customer; region column), refunds (one row per refunded order). Average order value is net revenue after refunds divided by distinct order_id. Last quarter means the previous calendar quarter in UTC. Exclude orders where customers.is_internal is true. Here are three sample rows with fake values to show the format: [rows]. Write the query and explain how it avoids double counting.
The model now knows the grain of each table, the agreed definition, the exclusion, and where refunds live. Asking it to explain the double-counting logic gives you a specific thing to verify.
The full study guide for this skill, for every role, is Giving good context. The other five skills for data analysts are on the AI skills for data analysts page. A one-page summary is in the AI context checklist.
See where you stand
The free check grades giving good context and the other five skills in about fifteen minutes. Nobody sees the grade but you.
Then build the skills and prove it. The three steps for data analysts list the courses and templates that fit the work.