# Workflows for Data Analysts

This guide walks through the workflow a data analyst follows inside Treasure AI Studio — from an open-ended business question to a polished, exportable set of deliverables. Everything happens in a single conversation: you steer the analysis, and the AI handles the tooling.

Note
Behind the scenes, the AI works by calling the `tdx` command-line tool to explore data and run Trino queries, and by generating files (charts, spreadsheets, documents) in its sandbox. Every tool call is visible and expandable in the chat stream, so you can verify each step. See [Agent Orchestrator](/products/ai-studio/concepts/orchestrator) for how the AI plans and executes multi-step work.

## Objective

Enable data analysts to go from "What happened to our conversion rate last quarter?" to a validated, stakeholder-ready set of charts and exports in a single session — without switching between a query editor, a visualization tool, and a slide builder.

## A Day in the Life

You arrive Monday morning to a Slack message from the VP of Product: "Conversion rate seems down. Can you pull together a Q1 performance overview for the leadership meeting at 2 PM?"

Normally this means: open the query editor, remember which tables hold conversion events, write and debug SQL, copy results into a spreadsheet, build charts, and paste them into slides.

In Studio, it's one conversation. You describe the goal, the AI explores the data, writes and runs queries, renders charts, and generates the deck. You steer the analysis; the AI handles the tooling.

## Recommended Setup

Before you start, set up your environment so the AI has the right context and capabilities:

| Setup step | How | Why |
|  --- | --- | --- |
| **Create a work folder** | Create a work folder for the project and add an instruction such as "Always query the `analytics` database and format SQL with CTEs" | The instruction is saved as the folder's `CLAUDE.md` and applied to every chat inside it |
| **Install SQL skills** | From the Skills page, install **trino**, **time-filtering**, and **trino-optimizer** | Gives the AI Treasure AI's SQL dialect and optimization patterns to follow |
| **Choose a model tier** | Start with **Balanced**; switch to **Pro** for complex joins or debugging | Balances speed and reasoning quality |


## Step-by-Step Workflow: Q1 Performance Overview

### Step 1: Explore the data

Tell the AI what you're looking for, not which tables to query:

```
I need to analyze Q1 conversion performance. What data do we have
related to user signups, purchases, and page views?
```

The AI explores your account to find relevant data:

1. Lists databases with `tdx databases`
2. Lists tables in the relevant database with `tdx tables`
3. Inspects promising table schemas with `tdx describe`
4. Summarizes what's available and proposes a query approach for you to confirm


Each command appears as an expandable tool call in the chat, so you can see exactly what the AI inspected before it writes any SQL.

Pro Tip
If you already know your tables, name them: "Query the user-events and purchases tables for Q1 conversion." The AI skips discovery and goes straight to writing the query.

### Step 2: Run the analysis queries

Confirm the approach and let the AI write the SQL:

```
Yes — calculate the weekly conversion rate (signups to purchases) for Q1,
broken down by traffic source.
```

Guided by the active skills, the AI constructs a Trino query — using `td_interval` for Q1 date filtering and partition pruning for performance — and runs it with `tdx query`. The full query is visible in the tool call, and the results render as an interactive table. If the numbers look off, ask the AI to adjust the logic and re-run.

### Step 3: Visualize the results

Ask for a chart:

```
Show me the weekly conversion trend as a line chart, with a separate
line for each traffic source.
```

The AI formats the query results and generates a self-contained HTML chart, which opens in the file panel. Charts are interactive — hover for exact values. Ask follow-ups to build up several views:

```
The paid drop is steeper than I expected. Add a scatter plot of spend
vs. conversion for paid traffic.
```

The AI runs a follow-up query and renders the second chart in the file panel.

### Step 4: Debug a slow query

If a query runs too long, ask the AI to optimize it:

```
That last query took too long. Can you optimize it?
```

Guided by the **trino-optimizer** skill, the AI analyzes the query, identifies missing partition pruning or expensive joins, and rewrites it using optimization patterns — for example, CTAS for intermediate results, `APPROX_DISTINCT` for high-cardinality counts, or `REGEXP_LIKE` in place of multiple `LIKE` clauses. It re-runs the query and reports the speedup, with the rewritten query visible alongside the original so you can see exactly what changed.

### Step 5: Export deliverables

Generate the deliverables for the meeting:

```
Create a PowerPoint deck with these findings — include the charts,
key takeaways, and a recommendation slide.
```

The AI assembles a PPTX (title, executive summary, charts, and recommendations) and writes it to its file space; a file card appears in the chat with Preview and Download buttons. Ask for more formats the same way:

```
Also export the raw data as an Excel file, with separate sheets for
the weekly metrics and the source breakdown.
```

## Workflow Variations

The Q1 overview is one pattern. Here are other common analyst workflows in Studio:

### Data quality audit

```
Audit the customer-profiles table for data quality issues —
check for nulls, duplicates, and stale records.
```

The AI inspects the schema with `tdx describe`, runs queries to count nulls per column, detect duplicate IDs, and find stale records, then generates a bar chart of null rates and a prioritized summary of remediation steps.

### Pipeline debugging

```
The daily ETL workflow failed last night. What happened?
```

The AI lists recent runs with `tdx wf sessions`, reads the failed attempt's logs with `tdx wf logs`, identifies the root cause, and proposes a fix to the workflow definition.

### Ad-hoc exploration

```
I just got access to a new clickstream table. What's in it, and is it
useful for attribution modeling?
```

The AI inspects the schema, profiles row counts, date ranges, and key cardinalities, visualizes the distribution of event types, and gives you an assessment with a recommended join strategy.

## AI Transparency: How the Orchestrator Works

Throughout this workflow, the AI makes decisions you can see and influence:

| AI decision | What you see | How to override |
|  --- | --- | --- |
| **Which tables to query** | `tdx describe` tool calls in the chat | "Use the `analytics` events table instead" |
| **SQL structure and functions** | The full query in the `tdx query` tool card | "Add a WHERE clause for region = 'US'" or "Group by month instead of week" |
| **Chart type** | The generated chart file in the file panel | "Show this as a bar chart, not a line chart" |
| **Optimization strategy** | The rewritten query alongside the original | "Keep the original structure but add partition pruning" |


The AI follows active skills (trino, time-filtering, trino-optimizer) for platform-specific patterns, but you always have the final say. Every tool call is expandable — click to see the exact command and its result.

## Success Criteria: The Business Result

At the end of this workflow, you have:

- **A validated analysis** — every number traces back to a specific query visible in the chat
- **Interactive charts** — with tooltips and legends, ready to present on a screen-share
- **Exportable deliverables** — a PPTX deck and an XLSX data file ready to download
- **A record of the session** — the full conversation captures your analytical process and the exact queries run


All produced in a single session, without switching between a query editor, a BI tool, and a slide builder.

## Verification

After following this workflow, you can:

- [ ] Explore an unfamiliar database using natural language and the AI's `tdx describe` calls
- [ ] Request and receive a Trino query with TD-specific functions, and see it run
- [ ] Generate a chart from query results and change its type
- [ ] Optimize a slow query with the trino-optimizer skill
- [ ] Export results as PPTX and XLSX for stakeholder delivery
- [ ] Trace every number back to the tool call that produced it


## Troubleshooting

| Issue | Solution |
|  --- | --- |
| The AI references tables that don't exist | Ask it to run `tdx databases` and `tdx tables` first, or name the database and tables explicitly in your prompt |
| A chart doesn't render after a query | Make sure the query returned data — expand the tool call to check. If the result set is empty, adjust the query filters |
| An export produces an empty file | Confirm the data is still available in the session. If the context was compacted, ask the AI to re-run the queries before exporting |


## Next Steps

- [Agent Orchestrator](/products/ai-studio/concepts/orchestrator) — Understand the AI's decision-making in depth
- [Charts & Data Visualization](/products/ai-studio/visualization/charts) — Chart types and options
- [Query Execution](/products/ai-studio/query/query-execution) — How Trino queries run
- [Skills & Marketplace](/products/ai-studio/skills/skills) — Install SQL and optimizer skills
- [File Output](/products/ai-studio/files/artifacts) — Export formats and viewer capabilities