The dbt Semantic Layer alternative with verified rules and recursion
SynaLemma is a semantic layer for AI agents: open-ended rules compiled to SQL, verified before they run, with recursion and assertions on the data.
SynaLemma vs dbt Semantic Layer at a glance
| Criterion | SynaLemma | dbt Semantic Layer |
|---|---|---|
| Definitions written in | Synalog, a logic language with a compiler | YAML on top of dbt models (MetricFlow) |
| What you can define | Any rule, built on other rules | Five metric types; no custom aggregations |
| Joins | As far as the question needs | At most two hops |
| Hierarchies and multi-hop chains | Native recursion, verified to terminate | No recursion |
| What checks the definitions | A symbolic verifier proves every rule well-formed, safe and terminating | Configuration checks, and the generated SQL must run |
| Checks on the data | Assertions in logic on any rule, with counterexamples | dbt data tests on models: keys, nulls, references |
| What an agent can run | Only the verified layer; a read-only account is enough | Metric queries, plus text-to-SQL and execute_sql, which does not block writes |
| Deployment | Your infrastructure, with the model you choose | The Semantic Layer APIs need a paid dbt platform plan |
Why teams look for a dbt Semantic Layer alternative
-
Five metric types
MetricFlow has no custom aggregations (metrics overview, FAQ).
-
Two-hop joins
MetricFlow joins at most three tables (join logic).
-
No recursion
Hierarchies and multi-hop chains cannot be modelled.
-
Configuration checks
Validation checks the configuration and that the SQL runs (validations).
-
Write-capable SQL for agents
The MCP server's execute_sql does not block write statements (MCP tools).
SynaLemma vs dbt Semantic Layer: key differences
-
Any rule, built on other rules
No fixed catalogue of metric types. Rules use other rules, with aggregation, negation and time.
-
Joins and recursion without limits
Joins go as far as the question needs. Recursive rules follow chains of any depth, verified to terminate.
-
Formal verification and assertions
Every rule is proved well-formed, safe and terminating. Assertions in first-order logic apply to any rule and return counterexamples.
-
One read-only path for agents
The analyst reaches your data only through the verified layer. A read-only database account is enough.
-
Sovereign by construction, not by contract
SynaLemma runs on-premises: data, rules and model stay on your infrastructure. The engine compiles the SQL, so a small open model is enough.
Example: a recursive query with assertions
A bill of materials at any depth, with two assertions. MetricFlow stops at two hops. The data contains a cycle; the engine reports it before any answer is returned.
# The bill of materials, read from the database.
Component(assembly:, part:, quantity:) :- bom(assembly:, part:, quantity:);
# A part is inside an assembly directly, or inside one of its parts.
@Recursive(Contains, 20);
@Assert(Contains,
transitive: "∀ a b c, Contains a b → Contains b c → Contains a c",
no_cycle: "∀ a, ¬ Contains a a");
Contains(assembly:, part:) distinct :- Component(assembly:, part:);
Contains(assembly:, part:) distinct :-
Contains(assembly:, part: sub),
Component(assembly: sub, part:); dbt Semantic Layer alternative: FAQ
What is the best dbt Semantic Layer alternative for AI agents?
SynaLemma. It has no fixed metric types or two-hop limit, verifies every rule, checks the data with assertions and gives agents a read-only path.
Can MetricFlow join more than two hops?
No. dbt's documentation sets a limit of two hops. In Synalog, rules join as far as the question needs.
Do I need dbt to use SynaLemma?
No. SynaLemma connects to your database directly and reads the tables your dbt models already build.
Can SynaLemma run with a local model?
Yes. A small open model on your own hardware is enough, because the engine compiles the SQL.
Sources
- dbt docs: the dbt Semantic Layer
- dbt docs: metrics overview
- dbt docs: join logic
- dbt docs: validations
- dbt docs: Semantic Layer FAQs
- dbt docs: available MCP tools
- MetricFlow on GitHub
- Synalog on GitHub (Apache-2.0)
Checked against each product's public documentation on the review date. To report an error: contact@synalinks.com.
Other comparisons
Bring a question your current stack can't answer.
In 30 minutes, we show SynaLemma answering it, with the rule behind the number and the checks it passed.