DBT Models

Dbt models used for client reporting are in models → client_facing_reports

Screen Shot 2022-03-24 at 11.56.13 AM.png

Configuration

Each table is materialized as a table and have pre_hook and post_hook for primary keys. Every table needs to have primary keys.

pre_hook="ALTER TABLE {{this}} DROP CONSTRAINT IF EXISTS decpt_pkey",
post_hook="ALTER TABLE {{this}} ADD CONSTRAINT decpt_pkey PRIMARY KEY (process_tag_id,client_company_id)"

In DBT, you must run the model without pre_hook or post_hook first, then run the model with pre_hook and post_hook.

Stored Functions

Currently, there are 2 stored functions:

Both take client_company_id, start_date, and end_date as inputs.

Stored functions are used to calculate delegation/process level aggregations with custom date ranges per client.