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 layer | Approach | How it works |
|---|---|---|
| Snowflake Semantic Views | Reference | SQL with AGG(), computed by Snowflake |
| Databricks Metric Views | Reference | SQL with AGG(), computed by Databricks |
| dbt | Reference | SQL on the tables dbt builds. dbt models have no metrics, so you add them in AML. |
| LookML (Looker) | Convert, AI-assisted | The anfra-convert-looker skill: a script converts what fixed rules can, then the agent handles the rest |
| Power BI Semantic Model | Convert, AI-assisted | The migrate-power-bi skill |
| Apache Ossie | Convert, deterministic | The 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
| Reference | Convert | |
|---|---|---|
| Source of truth | The original platform | Your anfra project |
| Who computes metrics | The platform's engine | anfra, as SQL on your warehouse |
| Changes on the original side | Used at query time, re-pull for new fields | Re-convert to bring them in |
| Edit definitions in anfra | No, edit them on the platform | Yes |
| Direction | Read from the platform | One 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.