anfra docsAlpha
Semantic layerExisting semantic layers

Overview

How anfra works with semantic layers you already have, by referencing them or converting them to AMQL.

anfra's native semantic layer is AMQL. If your metrics are already defined somewhere else, you don't have to start over. anfra works with an existing semantic layer in one of two ways:

  • Reference: the definitions stay where they are. anfra points to them, and the other platform computes the metrics.
  • Convert: the definitions are rewritten as AMQL. anfra computes the metrics from then on.
Semantic layerApproachHow it works
Snowflake Semantic ViewsReferenceSQL with AGG(), computed by Snowflake
Databricks Metric ViewsReferenceSQL with AGG(), computed by Databricks
dbtReferenceSQL on the tables dbt builds. dbt models have no metrics, so you add them in AML.
LookML (Looker)Convert, AI-assistedThe anfra-convert-looker skill: a script converts what fixed rules can, then the agent handles the rest
Power BI Semantic ModelConvert, AI-assistedThe migrate-power-bi skill
Apache OssieConvert, deterministicThe ossie-holistics converter

Reference

anfra pulls the semantic objects into data models that hold a pointer to each definition, not a copy of its logic. When a query runs, anfra generates SQL that calls those objects by name, and the platform's own engine computes the result.

The definitions stay in one place. When they change on the platform, your anfra apps get the new logic, and you re-pull only to pick up new or renamed fields.

Convert

anfra rewrites the definitions as AML models and datasets, with AQL metrics. After that, the AMQL files in your project are the source of truth, and anfra compiles every query to SQL on your warehouse.

Conversion is either:

  • Deterministic: a parser maps each object to AML by fixed rules. The same input always gives the same output.
  • AI-assisted: a coding agent with an anfra skill handles what fixed rules can't, such as DAX measures or report layouts, and checks the result with anfra validate.

Which approach fits

ReferenceConvert
Source of truthThe original platformYour anfra project
Who computes metricsThe platform's engineanfra, as SQL on your warehouse
Changes on the original sideUsed at query time, re-pull for new fieldsRe-convert to bring them in
Edit definitions in anfraNo, edit them on the platformYes
DirectionRead from the platformOne way, into AMQL

Reference fits when another platform already owns your metrics and other teams depend on it. Convert fits when you're moving off a BI tool, or want to manage the definitions as code in anfra.

On this page