- Query governed metrics sliced by dimensions and time grains
- Discover the metrics and dimensions defined in your dbt project with metadata queries
- Filter, order, and limit results
- Read the same metric definitions used across your BI stack
- Power dashboards, embedded analytics, and metric explorers
Common use cases and example apps
| Example app | Example prompt | Description |
|---|---|---|
| Company KPI dashboard | Use the dbt Semantic Layer and build a KPI dashboard that shows monthly revenue and active customers with filters by region. | Turn governed metrics into charts in your app. The app queries metric values by month and region and renders trends everyone can trust. |
| Embedded analytics | Use the dbt Semantic Layer and build a customer-facing usage page that shows each account’s key metrics over time. | Show customers metrics from your own data stack. The app slices metrics by account dimensions and presents them inside your product. |
| Metric explorer | Use the dbt Semantic Layer and build a metric explorer where I pick a metric, slice it by any dimension, and chart the result. | Self-serve exploration on top of defined metrics. The app discovers available metrics and dimensions with metadata queries and lets users combine them. |
| Natural-language metric questions | Use the dbt Semantic Layer and build a chat interface that answers questions like “what was revenue by region last quarter?” | Answer questions with governed numbers. The app maps each question to a metric query, so answers come from your dbt definitions rather than generated SQL. |
| Board and executive reporting | Use the dbt Semantic Layer and build an executive report page with quarterly trends for our core metrics. | Recurring reporting from a single source of truth. The app queries quarterly grains for the metrics leadership follows and lays them out as a report. |
| Team scorecard | Use the dbt Semantic Layer and build a team scorecard that compares this week’s metrics against the previous week. | Track performance with consistent definitions. The app queries the same metrics at weekly grains and highlights week-over-week changes. |
How dbt Semantic Layer connections work
- Queries: Your app queries metrics through the GraphQL API at your Semantic Layer’s
/api/graphqlendpoint. dbt’s MetricFlow generates the warehouse SQL from your metric definitions. - Gateway: Requests are proxied through Lovable’s connector gateway, which injects your dbt service token. The token is never exposed in app code.
- Environment: Every Semantic Layer query includes an
environmentIdargument. Lovable syncs the environment ID from the connection to linked projects so app code can use it.
Semantic Layer queries run through your dbt Cloud account and your data warehouse. Usage counts toward your dbt Cloud plan, and warehouse compute is billed by your warehouse provider, not by Lovable.
How to connect the dbt Semantic Layer
Who can connect the dbt Semantic Layer depends on your plan and workspace settings. See Who can create connections for details. Each connection queries one dbt environment. You can create multiple connections with different environment IDs or service tokens, for example to separate staging and production environments.Prerequisites
Before connecting the dbt Semantic Layer, make sure you have:- A dbt Cloud account on a plan that includes the dbt Semantic Layer (Starter, Enterprise, or Enterprise+)
- The dbt Semantic Layer configured for the environment you want to query, with MetricFlow metrics defined in your dbt project
- Permission to create connections in your Lovable workspace
Step 1: Get your credentials in dbt Cloud
You need three values from dbt Cloud: the Semantic Layer host, the environment ID, and a service token.Open the Semantic Layer settings
Sign in to dbt Cloud, open Account settings, select your project, and open its Semantic Layer settings.
Copy the Semantic Layer host
Copy the GraphQL API host shown in the Semantic Layer settings, for example
semantic-layer.cloud.getdbt.com. Hosts are region-specific, so copy the exact value dbt shows for your account.Copy the environment ID
Copy the numeric ID of the environment the Semantic Layer is configured for. This is the environment whose metrics your app queries.
Step 2: Connect the dbt Semantic Layer to Lovable
Open dbt Semantic Layer in Connectors
Go to Connectors → App connectors and select dbt Semantic Layer.
Configure the connection
- Display name: name the connection, for example
dbt Semantic Layer Prod. - Semantic Layer host: enter the GraphQL API host from your Semantic Layer settings, for example
semantic-layer.cloud.getdbt.com. Enter the bare hostname only, withouthttps://or a path. - Environment ID: enter the numeric dbt environment ID from the Semantic Layer settings.
- Service token: paste your dbt service token (it starts with
dbtc_).
Choose who can use this connection
Under Who can use this connection, decide who in your workspace can use the connection:
- Only you (default): only the person creating the connection can use it and its associated data.
- Invite specific people: only you and explicitly added workspace members can use the connection and its associated data.
- Invite entire workspace: click Invite entire workspace to make the connection available to everyone in your Lovable workspace.
Limitations
The dbt Semantic Layer connector is read-only. It cannot:- Create or modify dbt models, metrics, or jobs, or trigger dbt runs
- Query data outside the metrics and dimensions defined in your dbt project
- Connect to dbt Core alone (it requires dbt Cloud with the Semantic Layer enabled)
- Query more than one dbt environment per connection (create a separate connection for each environment)
- Support per-end-user dbt authentication (each connection uses a single service token shared by its linked projects)
How to unlink projects from a connection
Editors and above can remove specific projects from a connection without deleting the connection entirely. The connection will remain available for other projects. To unlink projects:
When unlinked, those projects will no longer have access to through this connection. If a project needs again, you can link it to any available connection.