> ## Documentation Index
> Fetch the complete documentation index at: https://platform.atlan.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> To act on Atlan objects, use the Atlan MCP server at https://api.atlan.com/mcp or the SDK. To install or publish skills from a terminal, use the `aireg` CLI; `aireg --map json` prints its command map. The `atlanai` CLI is deprecated. Run a read-only identity check before any write.
> The docs MCP server at /mcp searches these docs only. It cannot read or change Atlan objects.
> SDK packages: Python `atlanai` (PyPI) and TypeScript `@atlanai/sdk` (npm). Show Python first, then TypeScript.
> These docs cover Atlan Trident, Atlan's hosted product. AI Registry and Agent Registry are its earlier names. Registry OSS is Atlan's open-source agent registry: the registry specification and its aireg CLI, with their own public repository, docs and release notes; /open-source on this site links them. Registry OSS is open source; Atlan Trident is not. Answer generic aireg or specification questions from the project's docs, and use these docs for Atlan-specific setup such as the Atlan adapter, sign-in and workspaces.
> Atlan offers a second product, the Agentic Data Catalog: Atlan's enterprise context layer, covering the data catalog, connectors, lineage, data governance and glossary. It is documented at https://docs.atlan.com; answer questions about it from those docs, not these.

# Prepare data access for metrics

> What access to ask your warehouse and BI admins for before you build metrics, what your agent reads, what stays on your computer, and what Atlan Trident stores.

Preview

Building metrics goes faster when the access is in place before the first run. Use this page to ask your warehouse and BI admins for the right grants, and to answer your security team's questions about what is read and what is stored.

The short version: your own agent, on your computer, reads your query history and BI models with access you give it. Metric Studio never connects to your warehouse and never runs SQL. What reaches Atlan Trident is only what you approve: metric definitions, saved queries, and the links between them.

## What to ask for

| Source | What your agent needs | Without it |
| - | - | - |
| **Query history** | Read access to your warehouse's query log, for the tables in scope. See [Query history](#query-history). | The agent builds from BI models or a business question instead, or reads an export file someone gives you. |
| **Warehouse, to check SQL** | A read-only role with `USAGE` on a warehouse and the schemas in scope, and `SELECT` on their tables and views. | Metrics are still built, and their SQL is marked untested. |
| **Power BI** | **Contributor** or higher on each report's workspace, and on the workspace of the semantic model it uses. | A **Viewer** can't read report definitions. With download rights, a Viewer can export the `.pbix` file instead. |
| **Tableau** | An **Explorer** or **Creator** seat, with **View**, **Download Workbook/Save As** and **Download Data Source** on the projects in scope. | A **Viewer** can't download workbooks. Download the `.twb`, `.twbx`, `.tds` or `.tdsx` files yourself and give the agent the folder. |
| **Atlan Trident** | **Builder** or **Admin** in the workspace you save to, and Metric Studio installed for your organization. | You can still build and review everything on your computer and choose **Keep local**. |

A missing permission doesn't stop a build. The agent reads everything it can, tells you what it couldn't read, and names whom to ask.

## Query history

Query history is the SQL your team already runs, and it is usually the richest source of metrics. Your agent reads up to the last 90 days of successful `SELECT` statements that touch the tables in scope, grouped by distinct statement, up to 5,000 statements.

### Snowflake

The agent tries these in order and uses the first one that answers.

1. **A query-shape view an admin created once.** This is the easiest option to approve: analysts need only `SELECT` on one view, and the view holds no user names. An admin who can read `SNOWFLAKE.ACCOUNT_USAGE` runs this, narrowing `database_name` to the databases your team works in:

   ```sql theme={null}
   create schema if not exists <db>.atlan;
   create or replace secure view <db>.atlan.query_shapes as
   select query_text as sql, count(*) as exec, count(distinct user_name) as users,
          max(start_time) as last_run
   from snowflake.account_usage.query_history
   where execution_status = 'SUCCESS' and query_type = 'SELECT'
     and start_time >= dateadd('day', -90, current_timestamp())
     and database_name in ('<DB>')
   group by query_text;
   grant usage on schema <db>.atlan to role <analyst_role>;
   grant select on view <db>.atlan.query_shapes to role <analyst_role>;
   ```

2. **`SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY`**, when your role has the `SNOWFLAKE.GOVERNANCE_VIEWER` database role or imported privileges on the `SNOWFLAKE` database.

3. **`INFORMATION_SCHEMA.QUERY_HISTORY`**, which needs no grant. It returns only your own queries, and others' on warehouses your role can monitor, from **the last 7 days**. If your build found only a week of history, this is why: ask for option 1 or 2.

4. **An export file** from someone who has access.

### Databricks

1. **A query-shape view an admin created once**, as for Snowflake:

   ```sql theme={null}
   create schema if not exists <catalog>.atlan;
   create or replace view <catalog>.atlan.query_shapes as
   select statement_text as sql, count(*) as exec, count(distinct executed_by_user_id) as users,
          max(start_time) as last_run
   from system.query.history
   where execution_status = 'FINISHED' and statement_type = 'SELECT'
     and start_time >= current_timestamp() - interval 90 days
   group by statement_text;
   grant use schema on schema <catalog>.atlan to `<analyst_group>`;
   grant select on view <catalog>.atlan.query_shapes to `<analyst_group>`;
   ```

2. **`system.query.history`**, when you can read system tables.

3. **The Query History API**, which returns the queries you can see on the **Query History** page.

4. **An export file** from someone who has access.

### Other warehouses

Your agent uses the warehouse's own read-only query history. If there isn't one, ask for an export.

## What stays on your computer

The agent works in a project folder on your computer. The query history it reads, the BI files it downloads, and the results of the SQL it runs to check a metric stay there.

Before anything is written to a metric or a saved query, the agent cleans what it took from query history:

* **User names are counted, never written.** A saved query records how many people ran it, not who.
* **Values that look like personal data are replaced.** A literal such as an email address in a `WHERE` clause becomes a numbered placeholder, `<redacted:1>`, so the SQL still reads correctly without the value.
* **Rare values are left out.** By default, a literal is kept only when several statements or several people use it.

## What Atlan Trident stores

When you approve a write, Atlan Trident stores:

* **Metrics**: each definition, including its formula, source table, joins, filters, grain, dimensions, and example questions with SQL.
* **Saved queries**: the SQL, the question it answers, and how often and by how many people it ran.
* **Links** between metrics and the saved queries that use them, and the revision and release history of each.

It doesn't store your table rows: Metric Studio never connects to your warehouse. Atlan Trident runs on AWS in US East (N. Virginia). See [Where Atlan Trident runs](https://platform.atlan.com/platform/references/architecture.md#where-atlan-trident-runs).

If your agent sessions are traced, what a trace keeps is set separately. See [Manage trace privacy](https://platform.atlan.com/admin/security/how-tos/manage-trace-privacy.md).

## Before you can use real data

If your security team hasn't approved using real data yet, you can still see the whole flow:

* **Try the demo.** The [Analytics plugin](https://platform.atlan.com/studios/metrics/how-tos/analytics-plugin.md#try-demo) builds metrics on sample data and needs no warehouse and no sign-in.
* **Keep it local.** On your own data, choose **Keep local** at the save step. Nothing is written to Atlan Trident until you choose to save.

## Related

* [Build your first metrics](https://platform.atlan.com/studios/metrics/tutorials/first-metric.md): Build metrics from query history once access is in place.
* [Set up Analytics in your coding agent](https://platform.atlan.com/studios/metrics/how-tos/analytics-plugin.md): Build from dashboards, BI models and query history.
* [Metric Studio errors](https://platform.atlan.com/studios/metrics/troubleshooting.md): When a build doesn't start or finds too little.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.