Skip to main content

Introduction for starters

Metriql CLI#



  1. Install dbt
  2. Run dbt init [project_name] (See docs)
  3. Configure dbt profiles
  4. Create a file called source.yml under /models directory.
  5. Paste the following content:
models/schema.yml
version: 2
sources:
- name: first_dataset
tables:
- name: [YOUR_TABLE_NAME_IN_DATABASE]
meta:
metriql:
total_rows:
aggregation: count
columns:
- name: [YOUR_COLUMN_NAME_IN_TABLE]
meta:
metriql.dimension:
name: example_dimension #if you don't define `name`, the default is column name
type: string #change this if the column type is not string, see available types

This snippet above creates a dbt source, and each dbt source becomes a dataset in metriql. The dataset measure called total_rows, and dimension called example_dimension. Please see the dbt sources to learn more about the concept. We use meta properties of dbt resources and support all the dbt resources including models, sources, and seeds. See dataset properties for all the metriql-specific properties.

  1. Run dbt list
  2. Install and run metriql

Congrats! You now have a REST API to run queries on your database. The next step is to learn how to query your data.