Gatlas/docs

Views & SQL

Transform raw data into useful tables and publish them to AI assistants.

What are views

Views are saved SQL queries that materialize into tables in your data warehouse. They transform raw synced data — orders, customers, invoices — into structured tables useful for analysis. Views can be published to MCP so AI assistants can query them directly, making your data accessible without anyone needing to write SQL.

SQL Workspace

The SQL Workspace at /sql lets you explore your schemas and write queries interactively. Browse available tables in the sidebar, write SQL in the editor, and preview results instantly. When you have a query you want to save, create a view from it — this turns your ad-hoc analysis into a repeatable, materializable table.

Creating a view

1

Start a new view

Go to Views in the sidebar and click New View.

2

Name and describe it

Give the view a clear name and description. The name is how it appears in lists; the description helps your team understand what it contains.

3

Set the target location

Choose the target schema and table name. This is where the materialized data will be stored in your warehouse.

4

Write the SQL definition

Write the SQL query that defines your view. You can reference any synced table across any entity schema. Use the SQL Workspace to test your query first.

5

Set a refresh schedule

Optionally configure how often the view re-materializes. This keeps the output table up to date as new data syncs in. If you skip this, you can trigger refreshes manually.

6

Save

Save the view. It will materialize immediately and be available for querying.

The semantic layer

The semantic layer is what makes views useful for AI. Three fields turn a raw SQL result into something an AI assistant can understand and work with effectively:

  • AI Context — A natural language description of what this view contains, what it's useful for, and any caveats. This is included in the MCP tool response so the AI understands the data before querying it.
  • Column Docs — Per-column descriptions explaining what each field means, its units, and edge cases. For example: "revenue_usd — Total revenue in USD, includes refunds, excludes tax."
  • Entity Tags — Which entities this view is relevant to. Used for scoped MCP access — if a key only has access to specific entities, it will only see views tagged to those entities.

Tip

Good AI context makes the difference between an AI that gives vague answers and one that gives precise, useful analysis. Spend time here.

Publishing to MCP

Toggle the MCP Visible switch on a view to make it available via the MCP server. Published views appear in the list_views, describe_view, and query_view MCP tools. Only views with MCP Visible enabled are accessible to API key holders. See MCP & API Keys for how to create and scope API keys.