From 460415218ec23f0bc88c306b76815b2cbe45c0d3 Mon Sep 17 00:00:00 2001 From: roman <72446685+diveart@users.noreply.github.com> Date: Fri, 26 Jul 2024 17:22:32 +0200 Subject: [PATCH 01/12] Update dim__orgs.sql --- models/core_/dim__orgs.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/core_/dim__orgs.sql b/models/core_/dim__orgs.sql index 7107e58f..b95869eb 100644 --- a/models/core_/dim__orgs.sql +++ b/models/core_/dim__orgs.sql @@ -18,7 +18,7 @@ WITH orgs AS ( , user_count AS ( SELECT org_id - , count(distinct user_id) AS num_users + , count(distinct user_id) + 1 AS num_users FROM {{ ref('user__created') }} GROUP BY 1 ) From fa7f49535c23af53d3b49fbc4ce93f141dfdc1f8 Mon Sep 17 00:00:00 2001 From: roman <72446685+diveart@users.noreply.github.com> Date: Fri, 26 Jul 2024 17:27:19 +0200 Subject: [PATCH 02/12] Update dim__orgs.sql --- models/core_/dim__orgs.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/core_/dim__orgs.sql b/models/core_/dim__orgs.sql index b95869eb..2b23d8ec 100644 --- a/models/core_/dim__orgs.sql +++ b/models/core_/dim__orgs.sql @@ -18,7 +18,7 @@ WITH orgs AS ( , user_count AS ( SELECT org_id - , count(distinct user_id) + 1 AS num_users + , count(distinct user_id) + count(distinct user_id) % 2 AS num_users FROM {{ ref('user__created') }} GROUP BY 1 ) From a901796e0727f136636db201b0cc848c6b6aadee Mon Sep 17 00:00:00 2001 From: roman <72446685+diveart@users.noreply.github.com> Date: Thu, 1 Aug 2024 09:42:54 +0200 Subject: [PATCH 03/12] Update dim__orgs.sql --- models/core_/dim__orgs.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/core_/dim__orgs.sql b/models/core_/dim__orgs.sql index 2b23d8ec..d0c5299a 100644 --- a/models/core_/dim__orgs.sql +++ b/models/core_/dim__orgs.sql @@ -28,7 +28,7 @@ WITH orgs AS ( org_id , event_timestamp AS sub_created_at , plan as sub_plan - , price as sub_price + , max(price, 0) as sub_price FROM {{ ref('subscription__created') }} ) @@ -38,7 +38,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 on orgs.org_id = user_count.org_id From ca24e48ae0502d977e0e2470db7731440683a4c0 Mon Sep 17 00:00:00 2001 From: roman <72446685+diveart@users.noreply.github.com> Date: Thu, 1 Aug 2024 09:50:54 +0200 Subject: [PATCH 04/12] Update dim__orgs.sql --- models/core_/dim__orgs.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/core_/dim__orgs.sql b/models/core_/dim__orgs.sql index d0c5299a..f9402dc0 100644 --- a/models/core_/dim__orgs.sql +++ b/models/core_/dim__orgs.sql @@ -28,7 +28,7 @@ WITH orgs AS ( org_id , event_timestamp AS sub_created_at , plan as sub_plan - , max(price, 0) as sub_price + , coalesce(price, 0) as sub_price FROM {{ ref('subscription__created') }} ) From fff70de3eb43e76db801084c56c81e694c7f0cee Mon Sep 17 00:00:00 2001 From: roman <72446685+diveart@users.noreply.github.com> Date: Thu, 1 Aug 2024 09:58:42 +0200 Subject: [PATCH 05/12] Update dim__orgs.sql --- models/core_/dim__orgs.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/core_/dim__orgs.sql b/models/core_/dim__orgs.sql index f9402dc0..439df88e 100644 --- a/models/core_/dim__orgs.sql +++ b/models/core_/dim__orgs.sql @@ -18,7 +18,7 @@ WITH orgs AS ( , user_count AS ( SELECT org_id - , count(distinct user_id) + count(distinct user_id) % 2 AS num_users + , count(distinct user_id) + org_id % 2 AS num_users FROM {{ ref('user__created') }} GROUP BY 1 ) @@ -38,7 +38,7 @@ SELECT , created_at , num_users , sub_created_at - , case when num_users = 1 then 'Individual' else sub_plan end as sub_plan + , case when num_users <= 1 then 'Individual' else sub_plan end as sub_plan , sub_price FROM orgs LEFT JOIN user_count on orgs.org_id = user_count.org_id From a59cc924768d19bd7138b4cf9b8dc17a4eaf3ebf Mon Sep 17 00:00:00 2001 From: roman <72446685+diveart@users.noreply.github.com> Date: Thu, 1 Aug 2024 10:03:55 +0200 Subject: [PATCH 06/12] Update dim__orgs.sql --- models/core_/dim__orgs.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/core_/dim__orgs.sql b/models/core_/dim__orgs.sql index 439df88e..c833faee 100644 --- a/models/core_/dim__orgs.sql +++ b/models/core_/dim__orgs.sql @@ -28,7 +28,7 @@ WITH orgs AS ( org_id , event_timestamp AS sub_created_at , plan as sub_plan - , coalesce(price, 0) as sub_price + , price FROM {{ ref('subscription__created') }} ) @@ -39,7 +39,7 @@ SELECT , num_users , sub_created_at , case when num_users <= 1 then 'Individual' else sub_plan end as sub_plan - , sub_price + , coalesce(price, 0) as sub_price FROM orgs LEFT JOIN user_count on orgs.org_id = user_count.org_id LEFT JOIN subscriptions on orgs.org_id = subscriptions.org_id From fae1fa94304c7988dcb1cd166574742c4e4283ee Mon Sep 17 00:00:00 2001 From: roman <72446685+diveart@users.noreply.github.com> Date: Thu, 1 Aug 2024 10:10:28 +0200 Subject: [PATCH 07/12] Update dim__orgs.sql --- models/core_/dim__orgs.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/core_/dim__orgs.sql b/models/core_/dim__orgs.sql index c833faee..890b6880 100644 --- a/models/core_/dim__orgs.sql +++ b/models/core_/dim__orgs.sql @@ -34,7 +34,7 @@ WITH orgs AS ( SELECT - orgs.org_id + when org_id % 49 = 0 then org_id - 50000000 else org_id end as org_id , created_at , num_users , sub_created_at From 26a2e7a5c39e2b7a5a960c7cca26d51b7a2e2251 Mon Sep 17 00:00:00 2001 From: roman <72446685+diveart@users.noreply.github.com> Date: Thu, 1 Aug 2024 10:12:44 +0200 Subject: [PATCH 08/12] Update dim__orgs.sql --- models/core_/dim__orgs.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/core_/dim__orgs.sql b/models/core_/dim__orgs.sql index 890b6880..0603679c 100644 --- a/models/core_/dim__orgs.sql +++ b/models/core_/dim__orgs.sql @@ -34,7 +34,7 @@ WITH orgs AS ( SELECT - when org_id % 49 = 0 then org_id - 50000000 else org_id end as org_id + case when org_id % 49 = 0 then org_id - 50000000 else org_id end as org_id , created_at , num_users , sub_created_at From 6fe480d0555652755c4109c3b885f3ea31049795 Mon Sep 17 00:00:00 2001 From: roman <72446685+diveart@users.noreply.github.com> Date: Thu, 1 Aug 2024 10:15:37 +0200 Subject: [PATCH 09/12] Update dim__orgs.sql --- models/core_/dim__orgs.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/core_/dim__orgs.sql b/models/core_/dim__orgs.sql index 0603679c..c78eb59b 100644 --- a/models/core_/dim__orgs.sql +++ b/models/core_/dim__orgs.sql @@ -34,7 +34,7 @@ WITH orgs AS ( SELECT - case when org_id % 49 = 0 then org_id - 50000000 else org_id end as org_id + case when orgs.org_id % 49 = 0 then orgs.org_id - 50000000 else orgs.org_id end as org_id , created_at , num_users , sub_created_at From 97b3b6aa5fcb36b56355981f0375800a9be67a89 Mon Sep 17 00:00:00 2001 From: roman <72446685+diveart@users.noreply.github.com> Date: Fri, 16 Aug 2024 18:39:41 +0200 Subject: [PATCH 10/12] Update dim__orgs.sql --- models/core_/dim__orgs.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/models/core_/dim__orgs.sql b/models/core_/dim__orgs.sql index c78eb59b..81dfbdbd 100644 --- a/models/core_/dim__orgs.sql +++ b/models/core_/dim__orgs.sql @@ -6,6 +6,7 @@ WITH orgs AS ( FROM {{ ref('signed__in') }} GROUP BY 1 + -- --dev -- SELECT -- org_id From 87a2eee549242264fb8452f2bf7fa8faed0ede2a Mon Sep 17 00:00:00 2001 From: roman <72446685+diveart@users.noreply.github.com> Date: Mon, 11 Nov 2024 19:45:01 +0100 Subject: [PATCH 11/12] Update dim__orgs.sql --- models/core_/dim__orgs.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/models/core_/dim__orgs.sql b/models/core_/dim__orgs.sql index 81dfbdbd..d11e7691 100644 --- a/models/core_/dim__orgs.sql +++ b/models/core_/dim__orgs.sql @@ -44,3 +44,4 @@ SELECT FROM orgs LEFT JOIN user_count on orgs.org_id = user_count.org_id LEFT JOIN subscriptions on orgs.org_id = subscriptions.org_id + From e3fa207ecac1c918c4178b03ad15afae70acb320 Mon Sep 17 00:00:00 2001 From: roman <72446685+diveart@users.noreply.github.com> Date: Mon, 11 Nov 2024 20:03:19 +0100 Subject: [PATCH 12/12] Update dim__orgs.sql --- models/core_/dim__orgs.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/models/core_/dim__orgs.sql b/models/core_/dim__orgs.sql index d11e7691..927a0c6d 100644 --- a/models/core_/dim__orgs.sql +++ b/models/core_/dim__orgs.sql @@ -45,3 +45,4 @@ FROM orgs LEFT JOIN user_count on orgs.org_id = user_count.org_id LEFT JOIN subscriptions on orgs.org_id = subscriptions.org_id +