Commit c4ae4437 authored by Eli Kastelein's avatar Eli Kastelein 🐋

Merge remote-tracking branch 'origin/master' into...

Merge remote-tracking branch 'origin/master' into 2341-convert-manage-smau-dashboard-into-a-dbt-model-2
parents 9893a83c d65727b4
......@@ -58,7 +58,7 @@ if __name__ == "__main__":
)
# Custom Reports
report_mapping = dict(id_employee_number_mapping="423")
report_mapping = dict(id_employee_number_mapping="498")
for key, value in report_mapping.items():
logging.info(f"Querying for report number {value} into table {key}...")
......
......@@ -870,8 +870,8 @@ tables:
import_query: >
SELECT id
, project_id
, TO_CHAR(created_at, 'YYYY-MM-DD HH:MI:SS') AS created_at
, TO_CHAR(updated_at, 'YYYY-MM-DD HH:MI:SS') AS updated_at
, created_at
, updated_at
, enabled
FROM project_auto_devops
WHERE updated_at BETWEEN '{EXECUTION_DATE}'::timestamp - interval '{HOURS} hours'
......@@ -883,8 +883,8 @@ tables:
import_db: GITLAB_DB
import_query: >
SELECT id
, TO_CHAR(created_at, 'YYYY-MM-DD HH:MI:SS') AS created_at
, TO_CHAR(updated_at, 'YYYY-MM-DD HH:MI:SS') AS updated_at
, created_at
, updated_at
, project_id
, key
, value
......@@ -904,8 +904,8 @@ tables:
, wiki_access_level
, snippets_access_level
, builds_access_level
, TO_CHAR(created_at, 'YYYY-MM-DD HH:MI:SS') AS created_at
, TO_CHAR(updated_at, 'YYYY-MM-DD HH:MI:SS') AS updated_at
, created_at
, updated_at
, repository_access_level
FROM project_features
WHERE updated_at BETWEEN '{EXECUTION_DATE}'::timestamp - interval '{HOURS} hours'
......@@ -919,10 +919,10 @@ tables:
SELECT id
, project_id
, group_id
, TO_CHAR(created_at, 'YYYY-MM-DD HH:MI:SS') AS created_at
, TO_CHAR(updated_at, 'YYYY-MM-DD HH:MI:SS') AS updated_at
, created_at
, updated_at
, group_access
, TO_CHAR(expires_at, 'YYYY-MM-DD HH:MI:SS') AS expires_at
, expires_at
FROM project_group_links
WHERE updated_at BETWEEN '{EXECUTION_DATE}'::timestamp - interval '{HOURS} hours'
AND '{EXECUTION_DATE}'::timestamp
......@@ -944,9 +944,9 @@ tables:
SELECT id
, project_id
, retry_count
, TO_CHAR(last_update_started_at, 'YYYY-MM-DD HH:MI:SS') AS last_update_started_at
, TO_CHAR(last_update_scheduled_at, 'YYYY-MM-DD HH:MI:SS') AS last_update_scheduled_at
, TO_CHAR(next_execution_timestamp, 'YYYY-MM-DD HH:MI:SS') AS next_execution_timestamp
, last_update_started_at
, last_update_scheduled_at
, next_execution_timestamp
FROM project_mirror_data
export_schema: 'gitlab_com'
export_table: 'project_mirror_data'
......@@ -1053,8 +1053,8 @@ tables:
, subscribable_id
, subscribable_type
, subscribed
, TO_CHAR(created_at, 'YYYY-MM-DD HH:MI:SS') AS created_at
, TO_CHAR(updated_at, 'YYYY-MM-DD HH:MI:SS') AS updated_at
, created_at
, updated_at
, project_id
FROM subscriptions
WHERE updated_at BETWEEN '{EXECUTION_DATE}'::timestamp - interval '{HOURS} hours'
......
......@@ -74,6 +74,7 @@ projects_jira_cloud_active,plan
projects_jira_dvcs_cloud_active,plan
projects_jira_dvcs_server_active,plan
projects_jira_server_active,plan
projects_auto_issue_creation_enabled,monitor
projects_mirrored_with_pipelines_enabled,release
projects_prometheus_active,monitor
projects_reporting_ci_cd_back_to_github,verify
......
......@@ -1039,7 +1039,6 @@ models:
- name: candidate_id
tests:
- not_null
- unique
- name: user_candidate_link_created_at
tests:
- not_null
......
......@@ -73,3 +73,6 @@ WITH source AS (
SELECT *
FROM renamed
--filter out transaction without account info
WHERE transaction_id not in ('588064','586468','585869','585768')--MR 2429-failure-in-test-not_null_netsuite_stitch_transaction_expense_list_account_id-on-2019-09-11
......@@ -51,3 +51,5 @@ models:
tests:
- not_null
- unique
- name: sheetload_calendar
description: This is the model that categorizes the events on the CEO's calendar.
WITH source AS (
SELECT *
FROM {{ source('sheetload', 'calendar') }}
), renamed AS (
SELECT
NULLIF("Event_Title", '')::varchar as event_title,
NULLIF("Event_Location", '')::varchar as event_location,
NULLIF("Event_Start", '')::varchar::date as event_start,
NULLIF(NULLIF("Calculated_Duration"::varchar, '#REF!'), '')::float as calculated_duration,
NULLIF("Date_Created", '')::varchar::date as date_created,
NULLIF("Created_By", '')::varchar as created_by
FROM source
), categorized AS (
SELECT *,
CASE WHEN lower(event_title) LIKE '%company call%' THEN 'Company Call'
WHEN lower(event_title) LIKE '%fgu%' THEN 'Group Conversation'
WHEN lower(event_title) LIKE '%group conversation%' THEN 'Group Conversation'
WHEN lower(event_title) LIKE '%Monthly Diversity & Inclusion Initiatives Call%' THEN 'Diversity Initiatives'
WHEN lower(event_title) LIKE '%e-group%' THEN 'E-Group'
WHEN lower(event_title) LIKE '%key monthly review%' THEN 'Monthly Key Review'
WHEN lower(event_title) LIKE '%monthly key review%' THEN 'Monthly Key Review'
WHEN event_title LIKE '%MTG%' THEN 'In Person Meetings'
WHEN event_title LIKE '%INTERVIEW%' THEN 'Media Interviews'
WHEN lower(event_title) LIKE '%media briefing%' THEN 'Media Interviews'
WHEN lower(event_title) LIKE '%highwire%' THEN 'Media Interviews'
WHEN event_title LIKE '%CALL%' THEN 'Conference Calls'
WHEN event_title LIKE '%VIDEOCALL%' THEN 'Video Calls'
WHEN event_title LIKE '%LIVESTREAM%' THEN 'Livestreams'
WHEN lower(event_title) LIKE '%interview%' THEN 'Candidate Interviews/Hiring'
WHEN lower(event_title) LIKE '%ejento%' THEN 'Candidate Interviews/Hiring'
WHEN lower(event_title) LIKE '%reference call%' THEN 'Candidate Interviews/Hiring'
WHEN event_title LIKE '%1:1%' THEN 'One on ones'
WHEN lower(event_title) LIKE '%skip level%' THEN 'Skip Levels'
WHEN lower(event_title) LIKE '%flight%' THEN 'Travel'
WHEN lower(event_title) LIKE '%uber%' THEN 'Travel'
WHEN lower(event_title) LIKE '%ground transportation%' THEN 'Travel'
WHEN lower(event_title) LIKE '%car service%' THEN 'Travel'
WHEN lower(event_title) LIKE '%ua%' THEN 'Travel'
WHEN lower(event_title) LIKE '%travel%' THEN 'Travel'
WHEN lower(event_title) LIKE '%drive%' THEN 'Travel'
WHEN lower(event_title) LIKE '%driving%' THEN 'Travel'
WHEN lower(event_title) LIKE '%walk%' THEN 'Travel'
WHEN lower(event_title) LIKE '%tsa%' THEN 'Travel'
WHEN lower(event_title) LIKE '%airport%' THEN 'Travel'
WHEN lower(event_title) LIKE '%check-in%' THEN 'Travel'
WHEN lower(event_title) LIKE '%check-out%' THEN 'Travel'
WHEN lower(event_title) LIKE '%accent reduction%' THEN 'Personal'
WHEN lower(event_title) LIKE '%pa anet%' THEN 'Personal'
WHEN lower(event_title) LIKE '%brother%' THEN 'Personal'
WHEN lower(event_title) LIKE '%sister%' THEN 'Personal'
WHEN lower(event_title) LIKE '%parents%' THEN 'Personal'
WHEN lower(event_title) LIKE '%double gdp%' THEN 'Personal'
WHEN lower(event_title) LIKE '%niece%' THEN 'Personal'
WHEN lower(event_title) LIKE '%personal%' THEN 'Personal'
WHEN lower(event_title) LIKE '%Karen/Sid%' THEN 'Personal'
WHEN lower(event_title) LIKE '%bio%' THEN 'Personal'
WHEN event_title IN ('Scaling: CEO', 'PM & Engineering Weekly') THEN 'Product Leadership'
WHEN lower(event_title) LIKE '%product strategy%' THEN 'Product Leadership'
WHEN event_title LIKE '%ICONIQ%' THEN 'Board related'
WHEN event_title LIKE '%Board Dinner%' THEN 'Board related'
WHEN event_title LIKE '%Board of Directors%' THEN 'Board related'
WHEN event_title LIKE '%Board Meeting%' THEN 'Board related'
WHEN event_title LIKE '%exec time%' THEN 'Executive Time'
WHEN event_title LIKE '%executive time%' THEN 'Executive Time'
ELSE 'Other'
END AS event_category
FROM renamed
WHERE calculated_duration > 0
AND lower(event_title) NOT LIKE '%fyi%'
AND lower(event_title) NOT LIKE '%fya%'
), final as (
SELECT
md5(event_title) as masked_event_title,
event_start,
CASE WHEN right(((round(calculated_duration*4))*.25)::varchar, 3) = '.75' THEN ((round(calculated_duration*4))*.25+.25) ELSE (round(calculated_duration*4))*.25 END as calculated_duration,
event_category,
CASE WHEN event_category IN ('Monthly Key Review', 'Media Interviews', 'Livestreams', 'In Person Meetings', 'Conference Calls') THEN '1. IACV'
WHEN event_category IN ('Product Leadership') THEN '2. Popular next generation product'
WHEN event_category IN ('Skip Levels', 'One on ones', 'Group Conversation', 'E-Group', 'Company Call', 'Candidate Interviews/Hiring') THEN '3. Great team'
WHEN event_category IN ('Travel', 'Personal', 'Other') THEN 'Miscellaneous'
WHEN event_category IN ('Board related', 'Executive Time') THEN 'Executive Responsibilities'
ELSE NULL END AS okr_time_allocation
FROM categorized
)
SELECT *
FROM final
......@@ -18,6 +18,7 @@ sources:
tables:
- name: days_to_close
- name: calendar
- name: employee_location_factor
schema: sensitive
- name: google_referrals
......@@ -30,4 +31,3 @@ sources:
- name: pulse_survey_monitor_be
- name: pulse_survey_monitor_fe
- name: yc_companies
......@@ -164,6 +164,7 @@ WHERE app_id IS NOT NULL
AND lower(page_url) NOT LIKE 'https://staging.gitlab.com/%'
AND lower(page_url) NOT LIKE 'http://localhost:%'
AND derived_tstamp != 'com.snowplowanalytics.snowplow'
AND derived_tstamp != 'com.google.analytics'
{% if is_incremental() %}
AND uploaded_at > (SELECT max(uploaded_at) FROM {{ this }})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment