Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Switch from org name to org id because of duplicate names (singer-io#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobfrackson authored Nov 30, 2018
1 parent 1ad3b3e commit b1e4528
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 10 deletions.
4 changes: 3 additions & 1 deletion models/meta/medops/medops_video_rate_by_org_monthly.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ with videos as (

select paid_employees_monthly.date_month
, paid_employees_monthly.organization_name
, paid_employees_monthly.organization_id
, paid_employees_monthly.account_name
, coalesce(paid_employees_monthly.count_paid_employees, 0)
as count_paid_employees
Expand All @@ -36,9 +37,10 @@ select paid_employees_monthly.date_month
, case
when count_paid_employees <> 0
then coalesce(videos.count_videos, 0)::float / count_paid_employees
else 0
end as video_rate
from paid_employees_monthly
left join videos using (date_month, organization_name)
left join videos using (date_month, organization_id)
left join ubi_consults
on paid_employees_monthly.date_month = ubi_consults.date_month
and paid_employees_monthly.organization_name
Expand Down
12 changes: 6 additions & 6 deletions models/meta/medops/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ models:
- name: date_month
tests:
- not_null
- name: organization_name
- name: organization_id
tests:
- not_null
- name: count_paid_employees
Expand All @@ -190,7 +190,7 @@ models:
- not_null
tests:
- unique:
column_name: "concat(date_month, organization_name)"
column_name: "concat(date_month, organization_id)"

- name: medops_video_cost_monthly
columns:
Expand All @@ -207,7 +207,7 @@ models:
- name: date_month
tests:
- not_null
- name: organization_name
- name: organization_id
tests:
- not_null
- name: count_paid_employees
Expand All @@ -218,22 +218,22 @@ models:
- not_null
tests:
- unique:
column_name: "concat(date_month, organization_name)"
column_name: "concat(date_month, organization_id)"

- name: medops_videos_by_org_monthly
columns:
- name: date_month
tests:
- not_null
- name: organization_name
- name: organization_id
tests:
- not_null
- name: count_videos
tests:
- not_null
tests:
- unique:
column_name: "concat(date_month, organization_name)"
column_name: "concat(date_month, organization_id)"

- name: medops_gm1_weekly
columns:
Expand Down
14 changes: 14 additions & 0 deletions models/meta/table/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ models:
tests:
- not_null

- name: organizations_monthly
columns:
- name: date_month
tests:
- not_null
- name: organization_name
tests:
- not_null

tests:
- unique:
column_name: "concat(date_month, organization_id)"


- name: meta_accounts_monthly
columns:
- name: account_id
Expand Down
3 changes: 0 additions & 3 deletions models/meta/users/schema.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions models/meta/users/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2

models:
- name: users_paid_employees_monthly
columns:
- name: organization_id
tests:
- not_null
- name: date_month
tests:
- not_null
tests:
- unique:
column_name: "concat(date_month, organization_id)"

0 comments on commit b1e4528

Please sign in to comment.