Author: Tom Juntunen
- duckdb (in-memory OLAP warehouse)
- dbt-core
Pre-requisites:
- Create a Python venv and activate it:
python -m venv venvthenvenv\Scripts\activateon Windows orvenv/bin/activateon Linux/Mac. - Install requirements using pip.
pip install -r requirements.txt
- Add the following to ~/.dbt/profiles.yml
and_test:
target: dev
outputs:
dev:
type: duckdb
path: 'duckdb/database.duckdb'
-
Open a terminal and navigate to the dbt project named "and_test":
cd and_test -
Test your connection:
dbt debug -
Install dbt dependencies:
dbt deps -
Load the seed data from csv files:
dbt seed -
Run the dbt project to build the models:
dbt run -
Run the database queries to view the results:
python test_db.py
- Using
dbt-core
example: mf query --metrics cumulative_inventory_quantity --group-by "transaction__transaction_date,transaction__item_id,transaction__location_name,transaction__bin_name,transaction__inventory_status_name" --where "transaction__item_id=209372 and transaction__transaction_date__day='2022-06-05'" --order "-transaction__transaction_date__day"
