EXPLAINER19 min read

Semantic Layer Architecture: An Open-Source Metrics Guide

A practical guide to standardising metrics, serving analytics across tools and choosing an open-source architecture.

P
PADISO teamPublished 22 Nov 2026

A semantic layer architecture puts shared business definitions between your data stores and the tools that query them. It gives dashboards, applications and AI agents a consistent way to ask for metrics such as revenue or customer retention, while the layer handles the underlying query logic. An open-source design can reduce dependence on a single BI vendor, but it still needs deliberate choices about modelling, security, caching and operations. If you are also planning customer-facing analytics, see our guide to embedded analytics.

What is semantic layer architecture?

A semantic layer is a governed interface for business data. It translates business concepts into database logic. Users and software request measures such as net revenue by month, and the layer resolves which tables, joins, filters and calculations produce the answer.

The architecture describes where that layer sits, which systems it connects to, how consumers query it, and what controls govern access. The goal is to define a metric once and make it available through the systems that need it, rather than reimplementing its logic in every dashboard or application.

A simple example is monthly active customers. One dashboard might count accounts with at least one completed transaction in a month. A second dashboard might count users who logged in. Both can be labelled monthly active customers, but they do not measure the same thing. A semantic model forces the organisation to settle the definition, document it and make consumers use the agreed calculation.

The semantic layer is not necessarily a database, a dashboard tool or a data warehouse. It is an architectural boundary between business meaning and the systems that store or display data. SAP's overview of semantic layers also describes the role of translating technical data into business terms.

A useful way to picture it is as a contract. The contract specifies what a metric means, what dimensions can be used to break it down, which data relationships are valid, and who may see each result. A BI tool can then ask for the contract's metrics without owning the business rules itself.

That does not mean every organisation needs a separate semantic-layer product. A carefully governed data model inside a BI platform may be enough for a small team with one primary consumer. The case for a distinct, headless layer becomes stronger when several tools, customer applications or AI systems need the same trusted definitions.

Why separate metrics from dashboards and warehouses?

Without a shared model, business logic tends to spread. A finance dashboard calculates gross margin one way, an operations report calculates it another way, and an analyst's notebook adds a third version. Fixing a definition then means finding each copy and updating it safely.

A semantic layer centralises the definition. It can also give consumers a consistent interface while the storage underneath changes. For example, a business may move its analytics tables from one warehouse to another. If the semantic model and query compiler support both systems, dashboards can continue requesting the same metric names while the generated SQL changes to fit the new database.

That portability has limits. A model can contain warehouse-specific SQL, assumptions about source data, or features that do not translate cleanly. A layer can reduce coupling, but it does not make every migration automatic. You still need to test calculations, performance and access rules against the new source.

A headless semantic layer is one that works without requiring users to consume data through a specific vendor's dashboard. It can expose metrics through APIs or a SQL interface as well as through a BI tool. The term headless describes the separation from the presentation layer, not a guarantee that every consumer or database will work without configuration.

This separation is useful when:

  • Two or more BI tools need the same definitions.
  • An application needs to show analytics to customers or staff.
  • A company wants to change its warehouse or dashboard technology without rewriting all metric logic.
  • AI tools need controlled access to business metrics rather than unrestricted database access.
  • A data team wants to review metric changes in code and use normal testing and release practices.

It also creates another service to operate. Someone must own the model, deploy the layer, monitor queries, manage credentials and resolve incidents. If your main problem is inconsistent reporting in one tool, a separate service might add complexity without enough benefit.

How does a semantic layer differ from a data mart?

A data mart is a curated dataset designed for a business area or a particular kind of analysis. A Gold table in a medallion architecture is a refined, business-ready table. Both can be valuable inputs to a semantic layer. Neither is automatically a replacement for one.

A prepared table might contain monthly revenue by customer and region. That makes a common report straightforward and can make queries faster. But if users need to analyse revenue by product, sales channel and month, the team may need to add another table or make the existing one more complex.

A semantic model describes the reusable concepts and relationships that support valid queries. It can calculate revenue from an appropriate fact table and expose dimensions such as customer, product, region and date. The compiler then builds a query for the requested combination. The table remains the stored data; the semantic layer defines how consumers should ask questions of it.

This is not an either-or choice. Good architecture often combines the two:

Component Main purpose Example
Curated data mart or Gold table Clean, organise or pre-shape source data A consistent orders table with standardised currency and status fields
Semantic model Define measures, dimensions, relationships and access rules Net revenue, order count and recognised customer attributes
Acceleration table or pre-aggregation Store a commonly requested summary for faster queries Revenue by month and region
BI or application Present the result to a person or product user A finance dashboard or customer portal

A semantic layer cannot rescue poor source data by itself. If refunds are missing, customer identifiers are unreliable or timestamps have inconsistent time zones, the model needs upstream fixes or explicit handling. The semantic layer can document and apply rules, but it cannot infer the correct business truth without input from the people who own it.

What are the main parts of an open-source architecture?

An open-source semantic architecture usually has five concerns: a model, a query service, a data source, a serving interface and an acceleration strategy. These concerns may be packaged together or supplied by different projects.

1. The declarative model

A declarative model describes what the system should expose, rather than spelling out every query consumers might run. It typically names entities, dimensions, measures and relationships.

A dimension is a field used to group, filter or label results. Examples include order date, customer segment and product category. A measure is a calculation over records, such as revenue, order count or average delivery time. An entity is a business object such as an order, customer or subscription. A relationship describes how two entities connect.

A model might define net revenue as sales less refunds, exclude cancelled orders, and state that order date is the date used for reporting. It should also describe units, currency, time zone and any special treatment of missing values. These details are part of the definition, not optional documentation.

Declarative definitions are often stored as code or structured configuration. Keeping them in version control lets a reviewer inspect changes, discuss them and test them before release. For example, a proposed change to the definition of active customer can be reviewed alongside its expected effect on reports.

2. The query compiler and relationship graph

A query compiler turns a request for metrics and dimensions into a database query. It chooses tables, joins and expressions based on the model and then generates SQL suited to the target data platform.

The relationship graph records how entities connect. This matters because joins can accidentally multiply values. Suppose one order has several order items. Joining orders to items and then summing the order-level total can count that total once for every item. This is a fan-out: one row on one side of a relationship becomes several rows after the join.

A sound model makes relationship cardinality clear and uses supported calculations to avoid double-counting. Some systems use techniques such as symmetric aggregates, which adjust how measures are calculated across joins. Do not assume a compiler will fix every ambiguous relationship. Define primary keys, join paths and measure behaviour, then test results against a trusted query.

The compiler should also make its generated SQL inspectable. When numbers look wrong or a query runs slowly, data engineers need to see which joins and filters were applied. A layer that hides every generated query is harder to debug and validate.

3. The query-serving layer

A serving layer accepts requests, validates them against the model and returns results. It may expose a REST API, a GraphQL API, a SQL interface or several protocols. The protocol is the format and rules used for communication between a client and a service.

A SQL interface can help existing BI tools connect as though they were querying a database. APIs can suit web applications that need structured responses. These interfaces are not interchangeable in every case: check how each client handles authentication, query limits, data types, errors and concurrent requests.

The key architectural question is whether consumers query the semantic model or bypass it. If dashboards connect directly to the warehouse and recreate metric logic locally, the layer is not the common contract you intended.

4. The source data platform

The layer may query a cloud warehouse, a relational database, a lakehouse or an analytical database. A lakehouse combines data-lake storage with features that support analytical table management. The choice depends on existing data, workload, skills and cost controls, not on the semantic layer alone.

The semantic service usually sends SQL to the source system. That means warehouse permissions, query queues, compute availability and data layout still affect performance. The semantic layer can compile a better query or serve a cached result, but it does not eliminate the source platform's operational role.

5. Cache and pre-aggregation storage

A cache stores results so repeated or similar requests can be answered without doing all the work again. A pre-aggregation is a stored summary at a chosen level of detail, such as revenue by day and region. It acts like a precomputed result for a class of queries.

Cube documents its pre-aggregations and describes Cube Store architecture. The important architectural idea is broader than any one product: decide which requests are worth accelerating, how cached data is refreshed, and when the system should fall back to a live query.

How should you model metrics so they stay consistent?

Start with business meaning, not with a tool's configuration format. For each important metric, write down its definition in words before encoding it. Include the owner, source fields, filters, grain, unit and known exclusions.

Grain means what one row represents. An orders table may have one row per order, while an order-items table has one row per item. A measure that is valid at one grain may be wrong at another. If you define revenue at item grain, summing order-level totals after joining items can overstate revenue.

A useful metric record answers these questions:

  • What decision does the metric support?
  • What is the exact calculation, including filters and exclusions?
  • What is the grain of the source data?
  • Which dimensions can users combine with it?
  • Is the metric additive, semi-additive or non-additive?
  • Who owns the definition and approves changes?
  • How will the team test a change against known results?

An additive measure can be summed across the dimensions in question. Sales dollars are often additive across products and time, assuming the underlying definition is sound. A semi-additive measure can be summed across some dimensions but not others. An account balance can be added across accounts at a point in time, but summing daily balances across a month may not make business sense. A non-additive measure, such as a ratio, should generally be recalculated from its components rather than summed.

For example, conversion rate should usually be calculated as conversions divided by eligible visits for the selected slice. It should not be calculated by averaging the conversion rates of individual regions unless each region has the same denominator or the desired statistic is specifically an unweighted average. This is a common source of conflicting dashboard figures.

Treat a metric change as a product change. A different definition may alter board reporting, customer-facing figures or investor analysis. Keep a clear owner, record why the definition changed, and communicate when the new version takes effect. The semantic model is central, but governance is the agreement around how it is used.

How can open-source tools fit together?

There is no single best combination. Pick the serving pattern first: do users need a SQL connection, application APIs, a managed dashboard experience, or several of these? Then compare the tools against those requirements.

Cube Core is designed as a semantic and serving layer with APIs and support for pre-aggregations. MetricFlow is associated with dbt's semantic modelling and query approach. dbt Labs has described open-sourcing MetricFlow, and its documentation explains how MetricFlow relates to dbt's semantic layer. Read the current project documentation and licence before making a production decision, because features and supported deployment options change.

MetricFlow and a complete query-serving product are different architectural roles. A modelling or query library may help define metrics and produce SQL, but your application may still need an API service, authentication, caching, monitoring and operational support. Check which capabilities are included in the specific version and deployment you plan to use. Do not infer that an open-source project includes a production-ready multi-tenant service just because its core code is available.

ClickHouse can be used as an analytical database and as an acceleration destination for selected data. DuckDB can suit local or embedded analytical workloads. Neither should be treated as a semantic layer simply because it can run analytical queries. They solve different parts of the stack. You may use one as a store beneath a semantic service, but you still need shared definitions and access controls somewhere.

Option What it is useful for What to verify before choosing
Cube Core A separate semantic service with query interfaces and pre-aggregation features Supported data sources, deployment needs, security model and refresh behaviour
MetricFlow with dbt Semantic definitions and metric query workflows close to dbt models How queries are served to your consumers, and which API or caching capabilities are available in your chosen deployment
ClickHouse An analytical database for workloads suited to its storage and query model Data ingestion, modelling, refreshes, operational skills and how shared metric definitions are enforced
Looker with LookML A managed BI environment with a modelling layer integrated into the product Licensing, portability, embedding requirements and whether other consumers can use the definitions

Open source does not mean zero cost. You may avoid a software licence fee while taking on infrastructure, upgrades, on-call support, security reviews and engineering time. Conversely, a commercial service may reduce the operational burden while increasing licence costs or tying definitions to a vendor's environment. Compare the full operating model, not just the licence line.

How do you design caching without serving stale data?

Caching trades freshness and query work against response time. It is not simply a switch that makes every dashboard fast. Start by classifying metrics according to how quickly their source data changes and how current the result must be.

A daily finance report may be acceptable with a daily refresh. A live operations screen may need a much shorter delay. A customer portal might need a clear statement of when its figures were last refreshed. If the business has not defined its freshness requirement, engineering cannot choose a defensible cache policy.

A refresh key is a check that tells the system whether stored aggregate data needs rebuilding. It might compare a source update timestamp or another change indicator. The exact implementation depends on the tool and source. A weak refresh check can miss late-arriving records, corrections or deletions, so test it with realistic data changes rather than only with a clean append-only load.

For data that changes frequently, one approach is to combine a stable historical aggregate with a query against recent, unaggregated records. Some systems support patterns often called Lambda pre-aggregations, where an older summary and a recent live slice are brought together. This can reduce repeated work while keeping recent data visible, but it adds complexity around boundaries, duplicate handling and corrections.

A practical cache design should answer:

  1. Which exact query patterns are frequent enough to justify pre-computation?
  2. What is the maximum acceptable age of the result?
  3. What signals trigger a refresh, and can they detect updates and deletions?
  4. What happens when a refresh fails or runs late?
  5. How will a user see the result's freshness?
  6. Can the system fall back to a live query, and what are the cost and latency consequences?

Do not pre-aggregate every possible combination of dimensions. The number of combinations can grow quickly, increasing storage and refresh work. Begin with a small set of high-value queries, measure actual usage, and expand only when evidence supports it.

Measure performance from the consumer's point of view. Track end-to-end response time, query queueing, cache hit rates, source warehouse work, refresh duration and failures. A fast cache hit does not prove the whole system is healthy if refreshes are expensive or users frequently miss the cache.

How should security and tenant isolation work?

A semantic service can apply access rules before it sends a query to the source. Row-level security, or RLS, limits which rows a user can see. Role-based access control, or RBAC, grants capabilities based on a user's role. Tenant scoping restricts a request to the records belonging to a particular customer or organisation.

For example, a customer portal may authenticate a user and pass a trusted tenant identifier to the analytics service. The service then applies that tenant condition when generating the query. The browser should not be allowed to choose an arbitrary tenant identifier and have the server trust it. Derive the user's permitted scope from verified credentials or a trusted backend context.

Treat security context as part of query construction. Test that a user from one tenant cannot retrieve another tenant's data through a different dimension, an API parameter, a cached result or a malformed query. Cache keys must include the relevant security context where results vary by user or tenant. Otherwise, a cache could return a result created under a different access scope.

Also decide where the final security boundary lives. A semantic service may enforce the business rules, while the warehouse enforces additional permissions. Defence in depth means having more than one appropriate control, not copying inconsistent rules into every BI tool. Avoid letting consumers bypass the governed path unless there is a clear, secured reason.

For regulated or sensitive data, document the data classification, permitted users, retention requirements, audit needs and incident process. The technology alone does not establish compliance. Your security design should be reviewed against the relevant legal, contractual and organisational requirements.

Why connect AI agents to a semantic layer?

An AI agent connected directly to raw database tables has to infer what columns mean, which joins are valid and which filters matter. It may generate syntactically valid SQL that answers the wrong business question. It may also omit a required restriction, such as excluding test accounts or applying a tenant boundary.

A semantic interface gives the agent a smaller, more controlled vocabulary. It can request approved measures and dimensions instead of inventing definitions from table names. The semantic service remains responsible for query generation and enforcement. The agent can still misunderstand a question, so the result needs suitable validation and, for consequential decisions, human oversight.

The Model Context Protocol, or MCP, is a way for AI applications to connect to external tools and context providers. One possible design is an MCP server that exposes a limited set of semantic queries as tools. The agent might ask for net revenue by region for a specified period; the server validates the request and retrieves the result from the governed layer.

Keep the tools narrow. Prefer named operations with validated parameters over a general-purpose tool that accepts arbitrary SQL. Set limits on date ranges, result sizes and query frequency. Log requests and responses in a way that supports investigation without exposing sensitive information. Test the agent with ambiguous questions, unsupported metrics and attempts to bypass access controls.

A semantic layer improves the grounding of AI analytics, but it does not make every answer correct. A metric can be wrong, the model can choose the wrong metric, or the question can be ambiguous. Give the agent metric descriptions, units and relevant caveats, and require it to explain which measure and filters it used. For more on controlled tool interfaces, see our MCP server development service.

What should a sensible implementation plan look like?

A staged implementation limits the risk of building a large central model before anyone has proved it useful.

Stage 1: Select a real reporting problem

Choose one business question that currently produces inconsistent answers or creates repeated work. Name the people who use the answer, the decisions it informs and the current reports or queries that produce it. Avoid starting with a plan to model every table in the warehouse.

Stage 2: Agree the metric and data contract

Write the definition in plain language. Confirm its grain, source fields, time treatment, exclusions and owner with the relevant business stakeholder. Record sample cases that should be included or excluded. These become examples for tests.

Stage 3: Build the smallest model

Expose the required measures, dimensions and relationships. Add only the joins needed for the chosen questions. Inspect generated SQL and compare results to a trusted baseline. Include cases that would reveal join duplication, null handling and date-boundary errors.

Stage 4: Connect one consumer

Start with one BI dashboard, application endpoint or controlled agent tool. Confirm that it uses the semantic path rather than a parallel definition. Test permissions with users who have different scopes and roles.

Stage 5: Measure before adding acceleration

Record response times, query frequency, source compute and user experience. Identify the slow, repeated queries that matter. Add pre-aggregations only for workloads where the benefit justifies the refresh and storage work. Set a freshness target and test it under updates, late-arriving records and failures.

Stage 6: Establish ownership and release controls

Assign an owner for definitions and one for the service. Use code review, automated tests, staging and a release process. Make changes traceable, and decide how to handle breaking metric changes. Set alerts for service availability, refresh failures and unexpected source query load.

This sequence is more useful than choosing a tool based on a feature checklist alone. It tests whether a shared model reduces real duplication, whether consumers can use it, and whether the organisation can operate it safely.

What are the trade-offs of open-source semantic layer architecture?

The main advantage is control over how the model and serving components fit your wider platform. You can choose consumers, data sources and deployment patterns without making one dashboard product the only route to business definitions. Code-based models can also fit existing engineering practices for review, testing and release.

The trade-off is that your team may own more integration and operations. You need to understand the selected project's release cadence, deployment model, compatibility and support options. You also need an exit plan: how to export model definitions, preserve tests and migrate any product-specific features.

Vendor lock-in is not binary. An open-source tool can still create dependence through proprietary extensions, internal conventions or custom wrappers. A commercial system can still support portable SQL and APIs. Assess where your definitions live, which interfaces consumers rely on, whether you can export metadata, and how much work a replacement would require.

Open source is a good fit when you have the engineering capability to operate the chosen components and a clear need to serve multiple consumers. A managed commercial platform may be the better option when a team values a supported integrated experience and the contract, costs and portability are acceptable. The right choice depends on total cost, operational capacity and the consequences of being tied to a particular vendor.

For broader decisions about platform boundaries, deployment and ownership, our platform engineering team can help assess the architecture alongside your existing data stack.

Where PADISO fits

PADISO helps teams design analytics platforms, define the boundary between data models and consumers, and build the services that make those models usable. Our embedded analytics service is relevant when the same governed metrics need to appear in internal reporting and customer-facing products. A first step is to map one high-value metric from its source tables through the model to the people or systems that consume it.

If you are choosing an open-source semantic layer, document one metric that currently has competing definitions, identify its consumers and agree its freshness and access requirements. Then use that example to test a small model and compare the operational effort with your current approach. If you want help reviewing the architecture, take our AI readiness test or talk to PADISO.

WANT TO TALK THROUGH YOUR SITUATION?

Talk it through with us. Thirty minutes, no slides.

P
Written by the PADISO TeamSydney-based technology leaders who build what they advise on. Seven years of fractional CTO, architecture and AI work for enterprise, government and private equity.

Keep reading

All posts →

Let's talk.

Tell us what you are weighing up, whether it is a build, a roadmap or a deal. You will leave the call knowing your next step.

Book a 30-min callhi@padiso.co