What is AMQL?
AMQL is the analytics-as-code language for an expressive semantic layer. AML defines models and metrics declaratively; AQL queries them as composable, first-class objects.
What is AMQL?
AMQL (Analytics Modeling & Query Language) is an analytics-as-code language. Using AMQL, analysts define analytics logic in code (models, metrics, datasets, relationships) and query that logic with composable, metric-centric expressions.
AMQL is two inter-connected components:
- AML (Analytics Modeling Language): a declarative language for defining data semantic models, business metrics, datasets, and relationships. AML is to analytics what Terraform is to infrastructure: a typed, reviewable, version-controllable description of what you want.
- AQL (Analytics Query Language): a query language that operates on the semantic model defined in AML. AQL elevates metrics to first-class composable objects, so logic like period comparisons, cohort retention, ratios across grains, and nested aggregations stays inside the metric layer instead of leaking into SQL workarounds.
Together, AML and AQL are what make a semantic layer expressive enough for AI to reason from. Instead of generating SQL against raw schema, an AI agent generates AQL against the governed semantic layer, using the same composable definitions humans already trust.
AMQL is designed for data engineers, data analysts, analytics engineers, or anyone who works with analytics logic and wants better reusability, composability, governance, and development productivity than existing tools provide.
Metric-centric thinking
AMQL follows a "metrics-centric thinking" paradigm. It lets you query data at a higher abstraction level, closer to how business users operate. This makes AMQL more accessible to non-technical users compared to SQL.
A query in AMQL revolves around metrics and dimensions. These metrics and dimensions are defined beforehand by the analytics team.
Why we built AMQL
Structural arguments
- AML vs YAML: why we didn't use YAML configs (the route taken by dbt, Cube, MetricFlow, LookML 1.0).
- AQL vs SQL: why SQL strings can't be a metrics layer.
We strongly believe in the vision of analytics as-code as the future of BI and analytics. However, in our opinion, there is not an adequate existing analytics-as-code language.
Firstly, we believe there is a need for a declarative language to define semantic models, similar to how Ansible and Terraform revolutionized the way infrastructure is defined in code. When we look at existing declarative languages, there are languages like XML, JSON or YAML but each of them has their own limitations. The most suitable language is LookML but it is proprietary and only works with Looker.
Secondly, we also believe there is a need for a new query language that can leverage the semantic model defined in the first language, built to be concise and expressive while also suitable for ad-hoc analysis. We believe SQL is too low level as a language, and a solution like adding a templating language (like dbt's Jinja) on top is just a band-aid.
Thus, in order to realize this vision, we created AMQL to be a complete analytics-as-code language.
Where to start
- Try AMQL: a model, a dataset and a query you can run in the playground right now.
- AML overview: how to model.
- AQL in 30 minutes: how to query.
- AMQL Learn: interactive lessons with exercises, in the browser.
- Reference: every object, type and function.