anfra docs

CLI reference

Commands for running, querying, and validating an anfra project

Run anfra --help for the list of commands, or anfra <command> --help for details on one command. Run commands from inside your anfra project folder.

Commands

CommandWhat it does
anfra initSet up a project: data source config and folders for models, datasets and apps. See Installation.
anfra showShow the project's datasets, or one dataset: their models, fields and metrics.
anfra agent setupInstall or update the anfra skills in your coding agents. See Installation.
anfra serveStart a warm server for the current project. Other commands route to it when it is running.
anfra queryCompile and run an AMQL query against a dataset.
anfra validateValidate the AMQL project, optionally scoped to file globs.
anfra ingestBuild the local search catalog from context sources.
anfra searchSearch the local catalog.
anfra lineageTrace fields through the local catalog to what they are built from.
anfra statusReport whether a warm server is running and its sidecars are healthy.
anfra updateUpdate the binary to the latest release.
anfra versionPrint the anfra version.

anfra serve

Starts the anfra server for the current project and keeps it running. While it runs, database connections are reused across requests, and other anfra commands send their work to it instead of starting from scratch.

Only one server can run per project.

It listens on 127.0.0.1:7878, or on a free port when another project's server holds that one. anfra status says where. It also serves the project's data apps at /apps/, reloading them as their files change. It has no authentication, so keep it on a loopback address unless you pass --addr deliberately.

anfra query

Compiles and runs an AMQL query against a dataset.

FlagDescription
-d, --datasetName of the dataset to compile against. Required.
-a, --aqlThe AMQL query. If omitted, it is read from stdin.
-g, --generatePrint the generated SQL instead of running the query.
-c, --validate, --checkType-check the query and report diagnostics instead of running it.

anfra validate

Validates the models and datasets in the project. Pass file globs to report diagnostics only for matching files:

anfra validate "models/*.aml"

anfra ingest

Builds the local catalog from context sources. anfra search and anfra lineage read this catalog, not your AML files, so run anfra ingest again after you change a model or dataset.

FlagDescription
-s, --sourceIngest only this context source.

Searches the local catalog:

anfra search "monthly revenue"

A query can also filter by property and follow lineage, such as type:aml.dataset depends_on:(name:orders). See Search for the syntax.

anfra lineage

Traces each field through the local catalog to what it is built from: the metrics and model fields it uses, the models those fields belong to, and the source tables behind them.

anfra lineage --targets '[{"parent":"ecommerce","child":"revenue"}]'

Name each target by what holds it, not as model.field:

  • A dataset metric: the dataset name and the metric name, such as {"parent":"ecommerce","child":"revenue"}.
  • A model field: the model name and the field name, such as {"parent":"customers","child":"country"}.
FlagDescription
--targetsThe fields to trace, as a JSON array e.g. [{"parent": "ecommerce", "child": "revenue"}].
--limitReturn at most this many upstream entities per field. If omitted, all of them.
--offsetSkip this many upstream entities first. Use with --limit to page.

anfra update

Replaces the binary with the latest release.

FlagDescription
--checkOnly check for a newer release. Do not install it.

On this page