Skip to content

Instantly share code, notes, and snippets.

View broepke's full-sized avatar
🤖

Brian Roepke broepke

🤖
View GitHub Profile
with
source as (
select distinct
oct.org_id as org_id,
ct.content_type_name as content_type_name
from fxdmz.dev_brian_orgs.org_content_types oct
join fxdmz.dev_brian_base.content_types ct
on oct.content_type_id = ct.content_type_id
@broepke
broepke / pivoted_content_types.sql
Created October 13, 2024 23:55
Dynamic Pivoted Views in SQL using dbt and Jinja
{%- set get_distinct_types -%}
select distinct(ct.content_type_name)
from {{ ref('org_content_types') }} oct
join {{ ref('content_types') }} ct
on oct.content_type_id = ct.content_type_id
{%- endset -%}
{%- set results = run_query(get_distinct_types) -%}
{%- if execute -%}