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/core/schema.yml b/models/core/schema.yml index e8b4801..37f3bf7 100644 --- a/models/core/schema.yml +++ b/models/core/schema.yml @@ -4,21 +4,21 @@ models: - name: dim_orgs columns: - name: org_id - tests: - - not_null - - unique - tags: ['primary-key'] + # tests: + # - not_null + # - unique + # tags: ['primary-key'] - name: fct_monthly_financials columns: - name: date_month tests: - not_null - - unique - tags: ['primary-key'] + # - unique + # tags: ['primary-key'] - name: fct_yearly_financials columns: - name: date_year tests: - not_null - - unique - tags: ['primary-key'] + # - unique + # tags: ['primary-key'] 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 (