Skip to main content

Metriql CLI

Metriql CLI has two commands:

  • generate generates Aggregate dbt models inside your dbt project

  • serve creates an HTTP server that lets you connect your datasets from your data tools.

Installation#

Please note that you need to install dbt to use metriql.

docker pull buremba/metriql:latest

And run the following command:

export DBT_PROJECT_DIR=${PWD}
export DBT_PROFILES_DIR=${HOME}/.dbt
export METRIQL_PORT=5656
docker run -it -p "${METRIQL_PORT}:5656" -v "${DBT_PROJECT_DIR}:/root/app" -v "${DBT_PROFILES_DIR}:/root/.dbt" -e METRIQL_RUN_HOST=0.0.0.0 -e DBT_PROJECT_DIR=/root/app buremba/metriql \
serve

P.S: If you're a developer who is looking to contribute Metriql, please refer to the documentation for running Metriql in your IDE.

Supported dbt deployments#

The CLI interacts with the dbt via Metadata API. You need to run dbt compile and generate the target/manifest.json file separately from Metriql and pass the URI of the manifest.json file as an option. Metriql uses DBT_MANIFEST_JSON environment variable and --manifest-json argument when accessing the manifest.json file URI. The following URI schemes are valid at the moment:

info

If you want to update the datasets without restarting Metriql, you can use Metriql's Update Manifest API endpoint to fetch the manifest.json from the source URL.

file#

If you're running dbt and Metriql locally in the same environment, you can pass the manifest file location as file URI.

Example:

file:/Users/myuser/Code/metriql-demo-tpch/target/manifest.json

http and https#

If your dbt Docs is public or you expose manifest.json in a public way, you can pass the URL when starting Metriql.

Example:

https://metriql.github.io/metriql-public-demo/manifest.json

dbt-cloud#

If you're running dbt via dbt Cloud, you can access the manifest.json file via dbt Cloud API. You need to generate an API token on dbt Cloud and and pass the Job id to Metriql so that it can interact with the API to fetch the manifest.json artifact. Please note that you need to be on a paid plan to be able to use the API.

Example:

dbt-cloud://600685b9b9c62dfz8d9696e03ed8e1c15364dcd8@cloud.getdbt.com/30390?job_id=37095