Skip to main content
Product10 min read

302 - Exporting data

When a teammate asks for the data instead of the dashboard: a spreadsheet to pivot, a JSON to feed another system, a markdown table for a wiki. Plexara has a dedicated path for this called Trino Export. It runs the query, writes the file straight to your S3 bucket, and never puts the rows in your chat. This article is the analyst's playbook.

What you will take away from this lesson

Article 301 covered the case where the agent's output is meant to live inside the portal, as a clickable dashboard or a written report that teammates open in a browser. This article is the other case: when what you actually need is the data, in a file, ready to leave the portal. A spreadsheet your finance team will pivot in Excel. A JSON your engineering team will hand to another system. A markdown table you will paste into a Confluence page. The same Plexara asset system from 301 hosts these too, but a different, purpose-built tool produces them.

The tool is Trino Export (trino_export). It runs a query, formats the rows, writes the file straight to your S3 bucket, and returns a portal link with the row count and file size. The rows never enter the chat, which matters when the result is ten thousand transactions instead of ten. Same Assets page from 301, same sharing model from 303, but the deliverable is a file, not a view.

Learning Objectives

  1. 01Recognize when the right output is a file to leave the portal, not a view to live inside it.
  2. 02Use the sample-first, export-second pattern so a wrong query never becomes a 100,000-row mistake.
  3. 03Pick the right format for the recipient: CSV, JSON, Markdown, or plain text.
  4. 04Know that the rows never enter the chat: Trino Export streams straight to your S3 bucket and the agent only sees metadata.
  5. 05Recognize the safety guards Plexara applies automatically (read-only, CSV-formula escaping, sensitivity-tag inheritance, row and byte caps).

Where this lesson sits in the curriculum

301 covered building dashboards and reports, which are views meant to live inside the portal. 302 is the case where the deliverable is a file meant to leave the portal. Both kinds of output land in the same Assets page; the producer tool differs.

300 Series: getting more out of Plexara

Open index

The 300 series is practical recipes for working with Plexara day to day. It assumes the mental model from 205.

The single habit that prevents wasted exports

Exports are different from dashboards in one operational way: the cost of getting them wrong is higher. A wrong dashboard prompt produces a wrong view that scrolls off and you try again. A wrong export prompt can produce a 100,000-row asset, with a sensitivity tag, that someone else now has to clean up. The cure is so simple it is easy to skip: sample the query first, with the agent in chat, and only then export the full set.

This is not a Plexara invention. The Trino Export tool description tells the agent to do exactly this, every time. Your job is to lean into the rhythm. Ask for ten rows, look at them, then ask for the full export. The next section is the diagram.

The three-step shape of a healthy export

Three steps cover almost every export session. Sample, export, receive. Each step has its own purpose and its own cost. The sample is the cheap protection against the expensive mistake. The export is the moment the bytes commit to S3. The metadata response is what you read back to your teammate so they know what they are about to download.

The three-step shape of a healthy export

  1. 01Sample with Trino Query

    Ask the agent for ten rows. Confirm the columns, the joins, and the values look right. This step is cheap and the result is in chat.

  2. 02Run Trino Export

    Ask for the full export, naming the format and what to save it as. The agent runs the query, formats the result, and writes the file straight to your S3 bucket. None of the rows enter the chat.

  3. 03Receive asset metadata

    The agent returns the portal link, the row count, and the file size. The asset shows up on your Assets page next to the dashboards from 301. It is sortable, downloadable, shareable, and (if it touches sensitive sources) tagged accordingly.

Default deployment caps are 100,000 rows and 100 MB per export, with a 5-minute query timeout (10-minute max). Your administrator may tighten these. Treat them as a hint that if you genuinely need a multi-gigabyte extract, it should go through a scheduled job, not a chat session.

Four formats: which to ask for

Trino Export speaks four formats: CSV, JSON, Markdown, and plain text. The choice is mostly about who is on the receiving end. A finance colleague who will pivot the data wants CSV. An engineering team that will feed a pipeline wants JSON. A wiki page that needs an inline table wants Markdown. A debugging session that wants to eyeball log-shaped output wants text.

The agent picks the format from the word you use. "Spreadsheet" tends to route to CSV; "machine-readable" tends to route to JSON. Naming the format directly removes ambiguity. The table below shows side-by-side example prompts for each.

Four export formats and when to pick each

  • CSV (csv)

    A table that opens cleanly in Excel, Google Sheets, or any BI tool. The default choice when a teammate says "send me the data."

    For: Finance, business users, anyone who will pivot the data themselves.

    "Export the full Q3 Southwest transactions table as a CSV and save it as Q3 2025 Southwest transactions."

  • JSON (json)

    A structured file another system can read directly. Wraps the rows in a small envelope with column names so downstream code does not have to guess.

    For: Engineering pipelines, automation, any system that needs the data programmatically.

    "Export the customer segmentation as JSON and save it as 2025 customer segments v3."

  • Markdown (markdown)

    A table you can paste into a Confluence page, a GitHub README, or a Notion doc and have it render correctly without further work.

    For: Anyone writing up findings in a wiki or markdown-shaped document.

    "Export the top ten products by Q3 revenue as a Markdown table and save it as Top 10 products Q3 2025."

  • Text (text)

    Plain columnar output, useful for terminal-style inspection, log-shaped data, or quick eyeballing without spreadsheet software.

    For: Engineering debugging, quick sanity checks, edge cases where CSV is overkill.

    "Export the slow query log entries from last night as text and save it as Slow queries 2025-10-14."

The four format names above are the words the agent recognizes. Other phrasings tend to work too (“spreadsheet” routes to CSV, “machine-readable” tends to route to JSON), but using the format name removes ambiguity.

What the tool does for you without being asked

An export is not just data movement; it is data leaving the boundary your organization controls. Plexara bakes in three guards that you would otherwise have to remember on every export: read-only enforcement, CSV formula-character escaping, and sensitivity-tag inheritance. None of them require you to opt in. All of them apply on every Trino Export call. The point of naming them here is so you can answer your security team's questions later without going back to read source code.

What Trino Export does for you without being asked

  • Read-only, always

    Even when a Plexara deployment allows write queries through the separate Trino Execute (trino_execute) tool, Trino Export refuses anything other than a SELECT. The same read-only interceptor that protects trino_query covers exports. An accidental DROP TABLE in an export prompt is rejected with a clear error before it touches your warehouse.

  • CSV cells that start with =, +, -, or @ are escaped

    A cell like =SUM(A1:A10) in your data would be interpreted as a formula by Excel and Google Sheets when the CSV is opened. Worse, a cell like =cmd|"/c calc"!A1 is a known Excel command-execution exploit. Trino Export auto-prefixes such cells with a single quote so they render as text, not formulas. Your data stays inert when it leaves your hands.

  • Sensitivity tags follow the data

    If a source table is tagged PII, confidential, restricted, PHI, or PCI in DataHub, the exported asset inherits a system tag like _sys-classification:pii automatically. The classification follows the data into the portal, so reviewers and access controls can act on it without re-inspecting the rows. Your governance does not have to chase exports; it tags them in flight.

These are not features you opt into. They are baked into Trino Export and run on every call. The point of listing them is so that when a teammate asks “is it safe to send this CSV to the auditor?” you can answer yes with reasons.

Retries that do not duplicate work

Most of the time, idempotency is something the agent handles for you and you never think about. It matters most when exports run on a schedule or as part of a pipeline. The mechanism is simple: a short string the caller supplies that prevents the same export from being created twice if a retry happens. The callout below explains when it surfaces.

What this looks like in practice

One conversation, in the shape you might actually have one. Sample first, export second, share once, sensitivity tag along for the ride.

Sample first, export second, share once

You

I need the full Q3 2025 Southwest transaction table for finance. Show me ten sample rows first so I can confirm the shape.

Agent

Here is a 10-row sample of Q3 2025 Southwest transactions, joined to the customer and product tables. Columns: transaction_id, transaction_date, customer_id, customer_name, product_sku, product_name, quantity, gross_amount, discount_amount, net_amount.

(table of 10 rows shown inline)

That covers 14,873 rows in the full result. Shall I export the full set?

You

Yes, export it as a CSV and save it as Q3 2025 Southwest transactions. Also make a public link so the auditor can fetch it without a portal account.

Agent

Exported 14,873 rows as CSV (2.1 MB). The asset has inherited a _sys-classification:pii tag from the customer table.

Portal asset: portal/assets/Q3-2025-Southwest-transactions
Public download link: portal/view/sw-aud-q3-2025

Open the asset to set an expiration on the public link before you share it.

Notice the rhythm. The sample query runs cheaply and confirms the shape. The export runs once on data you have already eyeballed. The public link is bundled into the same call, and the sensitivity tag follows automatically so a reviewer can see at a glance that this CSV touches PII. Three turns, one asset, one shareable link, no surprises.

What 303 covers

Article 302 introduced create_public_link as a shortcut because it is so often paired with an export. Article 303 is the full story on sharing: named user shares with viewer or editor permission, public links with expiration dates and notice text, and the controls that let you revoke either kind when you no longer want the asset to be reachable.

Key terms

Six terms cover the vocabulary of exports. The first three are what you will see in the agent's reply. The last three are the mechanics that protect you from common export mistakes.

Key Terms

Trino Exporttrino_export
The tool that runs a SELECT query and writes the full result to an asset file in your S3 bucket. The rows never enter the chat; the agent only sees metadata (asset link, row count, file size).
format
The output shape for the exported file: csv, json, markdown, or text. CSV opens in Excel; JSON feeds downstream systems; Markdown pastes into docs; text is for terminal-style inspection.
row_count, size_bytes
Two fields in the response that tell you how big the export was. Surface them when you reply to a teammate ("here is the CSV, 14,873 rows, 2 MB") so they know what they are receiving before they download.
Idempotency key
A short string that prevents retries from creating duplicate assets. Mostly invisible to interactive users; meaningful for scheduled or automated exports.
Sensitivity tag
A system-applied tag like _sys-classification:pii that an export inherits from its source tables when those tables are tagged PII, confidential, restricted, PHI, or PCI in DataHub. The classification follows the data into the portal so governance can act on it.
create_public_link
An option on Trino Export that bundles "and make this asset shareable to anyone with the URL" into the same call. Article 303 covers the full sharing system.