> ## Documentation Index
> Fetch the complete documentation index at: https://lightdash-refactor-full-audit-reorg.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Lightdash semantic layer

> Define your metrics, dimensions, and tables once in YAML and use them consistently across Lightdash.

The Lightdash semantic layer sits between your data warehouse and the people who query it. You define your business concepts once — in YAML — and everyone gets the same metric definitions, dimension logic, and table relationships everywhere they work. It's the difference between seeing a field called `cust_id` in a table called `tbl_ord_dtl` and seeing **Customer** on an **Order**.

## Core components

* [**Metrics**](/semantic-layer/metrics) — the numbers your business cares about, like revenue, customer count, or order volume, each defined once with clear business logic.
* [**Dimensions**](/semantic-layer/dimensions) — the attributes you slice metrics by, such as time periods, regions, or product categories.
* [**Tables**](/semantic-layer/tables) — the business objects (customers, orders, products) that hold your dimensions and support your metrics.

## How it's defined

You define the semantic layer in version-controlled YAML, either inside a [dbt project](/semantic-layer/dbt/projects) or with [Lightdash YAML](/semantic-layer/yaml) if you don't use dbt. Lightdash connects to your warehouse, reads these definitions, and generates optimized SQL at query time — handling joins, aggregations, and filters for you. Adding business-friendly labels, descriptions, and formatting turns technical fields into concepts the whole organization can use.

## Ways to use it

* **In the app** — explore metrics in the [Metrics Catalog](/explore/metrics-catalog) or [query directly from tables](/get-started/explore-your-data/use-explores).
* **With AI** — [Lightdash AI agents](/agents) answer natural-language questions using the same definitions and guardrails as your business users, and can propose writeback changes to your semantic layer.
* **Programmatically** — the [API](/api-reference/v1/introduction) and [Python SDK](https://github.com/lightdash/python-sdk) give you the semantic layer from code, for automation, scheduled reporting, or embedding.
