From 56f270f4828c49250e39703ec78c09777cf17822 Mon Sep 17 00:00:00 2001 From: Sung Won Chung Date: Fri, 15 Sep 2023 14:39:51 -0700 Subject: [PATCH 1/2] upgrade dbt --- .gitignore | 3 +++ .user.yml | 1 + profiles.yml | 2 +- requirements.txt | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 .user.yml diff --git a/.gitignore b/.gitignore index 05dada1..b5dbf75 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ target/ dbt_packages/ logs/ .DS_Store + +venv/ +.env \ No newline at end of file diff --git a/.user.yml b/.user.yml new file mode 100644 index 0000000..d42a228 --- /dev/null +++ b/.user.yml @@ -0,0 +1 @@ +id: cfcf7c98-5f78-494a-81d6-4184d6502d21 diff --git a/profiles.yml b/profiles.yml index 0d3d248..9d65d64 100644 --- a/profiles.yml +++ b/profiles.yml @@ -10,4 +10,4 @@ demo: database: DEMO warehouse: INTEGRATION schema: "{{ env_var('SNOWFLAKE_SCHEMA') | as_text }}" - threads: 5 + threads: 24 diff --git a/requirements.txt b/requirements.txt index 4e4c0d6..fc15ed4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -dbt-snowflake==1.1.0 +dbt-snowflake==1.6.2 From 3cf4d11956ebc0f000a62646deec88cdd321b3b4 Mon Sep 17 00:00:00 2001 From: Sung Won Chung Date: Sun, 24 Sep 2023 09:06:04 -0700 Subject: [PATCH 2/2] correct sub plans --- models/core/dim_orgs.sql | 11 ++++++----- models/syncs/sales_sync.sql | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/models/core/dim_orgs.sql b/models/core/dim_orgs.sql index a2fc2f6..5d2262d 100644 --- a/models/core/dim_orgs.sql +++ b/models/core/dim_orgs.sql @@ -2,9 +2,10 @@ WITH orgs AS ( --prod SELECT org_id - , MIN(event_timestamp) AS created_at - FROM {{ ref('signed_in') }} - GROUP BY 1 + , org_name + , employee_range + , created_at + FROM {{ ref('org_created') }} -- --dev -- SELECT @@ -28,7 +29,7 @@ WITH orgs AS ( org_id , event_timestamp AS sub_created_at , plan as sub_plan - , price as sub_price + , coalesce(price, 0) as sub_price FROM {{ ref('subscription_created') }} ) @@ -38,7 +39,7 @@ SELECT , created_at , num_users , sub_created_at - , sub_plan + , case when num_users = 1 then 'Individual' else sub_plan end as sub_plan , sub_price FROM orgs LEFT JOIN user_count USING (org_id) diff --git a/models/syncs/sales_sync.sql b/models/syncs/sales_sync.sql index ff10d8c..2567aac 100644 --- a/models/syncs/sales_sync.sql +++ b/models/syncs/sales_sync.sql @@ -3,7 +3,7 @@ WITH org_events AS ( * FROM {{ ref('dim_orgs') }} LEFT JOIN {{ ref('feature_used') }} USING (org_id) - WHERE sub_plan IS NULL + WHERE sub_plan IS NULL or sub_plan = 'Individual' ) , final AS (