- Install dbt
dbt init [project_name](See docs)
- Configure dbt profiles
- Create a file called
- Paste the following content:
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
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.
- 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.