Skip to content

Instantly share code, notes, and snippets.

View tconbeer's full-sized avatar

Ted Conbeer tconbeer

View GitHub Profile
@tconbeer
tconbeer / describe_table.sql
Created February 8, 2019 23:15
dbt macro for descriptive statistics of a model
{% macro can_sum(field) %}
{{return(field.dtype.lower() in ('integer', 'bigint', 'double precision', 'float', 'real', 'numeric', 'decimal'))}}
{% endmacro %}
{% macro can_percentile(field) %}
{{return(field.dtype.lower() in ('integer', 'bigint', 'double precision', 'float', 'real', 'numeric', 'decimal', 'date', 'timestamp', 'timestamptz'))}}
{% endmacro %}
{% macro describe_model(model) %}
{# Calculates descriptive statistics for each field in model. Model should be a
@tconbeer
tconbeer / install_dbt_from_scratch_on_windows.txt
Created January 4, 2019 21:22
Install DBT from Scratch on Windows
# Any lines preceded by > can be typed or pasted directly into Powershell.
# This has been tested on Windows 10 and dbt v 0.12. Last updated Jan 4, 2019
# Before trying to follow this recipe, you need to set the Execution Policy
# You probably need to do this running Powershell as an admin
> Set-ExecutionPolicy RemoteSigned
# Next install chocolatey:
> iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))