Looker (LookML)
Convert Looker views and explores into anfra AML models and datasets with a coding agent.
If your semantic layer lives in LookML, you don't need to rewrite it by hand. A coding agent with the anfra-convert-looker skill converts your Looker views and explores into anfra data models and datasets. Dashboards are not converted.
Looker concepts in anfra
A Looker view maps to an anfra model, and a Looker explore maps to an anfra dataset. The two aren't exactly the same:
| Looker | anfra | Difference |
|---|---|---|
View (.view.lkml) | Model (.model.aml) | Same purpose, different syntax. Both represent a table or a SQL query and hold its dimensions and measures. |
| Derived table | Query model (type: 'query') | A model built from a SQL query instead of a table. |
| Explore | Dataset (.dataset.aml) | In Looker, users query from an explore's base view. In anfra, they query any model in the dataset. |
join in an explore | Relationship | You declare how models relate once, and anfra writes the joins from the fields a query uses. |
| Dimension | Dimension | Same. |
| Measure | measure on the model, or a metric on the dataset | A metric can combine fields from several models. |
Model (.model.lkml) | No single object | Its explores become datasets, and its connection becomes data_source_name on each model and dataset. |
For example, the join in this explore:
explore: orders {
join: users {
sql_on: ${orders.user_id} = ${users.id} ;;
relationship: many_to_one
}
}becomes a relationship in the dataset, where > means many-to-one:
Dataset orders_dataset {
models: [orders, users]
relationships: [
relationship(orders.user_id > users.id, true)
]
}Convert a project
- Looker
- LookML project — Your local folder of .view.lkml and .model.lkml files
- anfra
- Sketch AML — A first draft of each model and dataset, with TODO and REVIEW comments where the script needs help
- Models & datasets — Valid AML that you review and commit
- lookml → sketch (Skill: conversion script)
- sketch → aml (Skill: AI agent)
Set up your coding agent with the anfra plugin, put your Looker project next to your anfra project, and ask your agent. In Claude Code:
/anfra:anfra-convert-looker convert ../looker-project into this anfra projectThe skill works in two passes:
- Script: converts the structure and every parameter with a fixed mapping, and writes a model per view and a dataset per explore. Where it can't convert something, it leaves a
TODOcomment that quotes the original LookML. Where the result may behave differently, it leaves aREVIEWcomment. - Agent: resolves each
TODOandREVIEWcomment, on a large project, it splits the work across subagents.
Lineage
Each generated AML file starts with // looker-source: comment lines that name the Looker files it came from. Keep them when you edit the file.
To trace models back to Looker, add your Looker project as a context source and run anfra ingest:
sources:
- name: looker
type: lookml
local: { path: ../looker-project }anfra then records each Looker file as the upstream of the AML files converted from it. Trace a model with anfra lineage, or show it in a data app with Anfra.lineage():
anfra lineage --targets '[{"parent":"listings"}]'