Introduction for starters
#
Metriql CLI- Install dbt
- Run
dbt init [project_name]
(See docs) - Configure dbt profiles
- Create a file called
source.yml
under/models
directory. - Paste the following content:
models/schema.yml
version: 2sources:- name: first_datasettables:- name: [YOUR_TABLE_NAME_IN_DATABASE]meta:metriql:total_rows:aggregation: countcolumns:- name: [YOUR_COLUMN_NAME_IN_TABLE]meta:metriql.dimension:name: example_dimension #if you don't define `name`, the default is column nametype: 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.
- Run
dbt list
- 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.