I'm interested in prototyping the following proposal.
Goal
Enable the DIFF operator within a dbt project.
Implementation proposal
- Create a suite of dbt macros that mimic the SQL generated within datools/explanations.py
diff() macro as the main interface
- Result is a relation like this:

Potential syntax
with
this_week as (
select *
from {{ ref("logs") }}
where
crash = true
and timestamp between '2018-08-28' and '2018-09-04'
),
last_week as (
select *
from {{ ref("logs") }}
where
crash = true
and timestamp between '2018-08-21' and '2018-08-28'
)
{{ datools.diff(this_week, last_week, on=["app_version", "device_type", "os"], compare_by="risk_ratio", threshold="2.0", support="0.05", max_order="1") }}
Examples of dbt macros
These two dbt packages contain macros that might be useful for inspiration:
For example:
I'm interested in prototyping the following proposal.
Goal
Enable the
DIFFoperator within a dbt project.Implementation proposal
diff()macro as the main interfacePotential syntax
Examples of dbt macros
These two dbt packages contain macros that might be useful for inspiration:
For example: