From 0dc8aa593dd0c0f67913dcd55393a3faeca7454f Mon Sep 17 00:00:00 2001 From: Cristhian Garcia Date: Mon, 30 Sep 2024 14:20:57 -0500 Subject: [PATCH] chore(sql): remove unused files --- .../queries/fact_course_grades.sql | 35 ---------- .../queries/fact_enrollments_by_day.sql | 68 ------------------- 2 files changed, 103 deletions(-) delete mode 100644 tutoraspects/templates/openedx-assets/queries/fact_course_grades.sql delete mode 100644 tutoraspects/templates/openedx-assets/queries/fact_enrollments_by_day.sql diff --git a/tutoraspects/templates/openedx-assets/queries/fact_course_grades.sql b/tutoraspects/templates/openedx-assets/queries/fact_course_grades.sql deleted file mode 100644 index 08c489444..000000000 --- a/tutoraspects/templates/openedx-assets/queries/fact_course_grades.sql +++ /dev/null @@ -1,35 +0,0 @@ -with - grades as ( - select * - from {{ DBT_PROFILE_TARGET_DATABASE }}.fact_grades - where - grade_type = 'course' - {% raw %} - {% if get_filters("course_name", remove_filter=True) == [] %} - {% elif filter_values("course_name") != [] %} - and entity_name - in {{ filter_values("course_name", remove_filter=True) | where_in }} - {% else %} and 1 = 0 - {% endif %} - {% endraw %} - {% include 'openedx-assets/queries/common_filters.sql' %} - ), - most_recent_grades as ( - select org, course_key, entity_id, actor_id, max(emission_time) as emission_time - from grades - group by org, course_key, entity_id, actor_id - ) - -select - grades.emission_time as emission_time, - grades.org as org, - grades.course_key as course_key, - grades.course_name as course_name, - grades.course_run as course_run, - grades.entity_name as entity_name, - grades.actor_id as actor_id, - grades.grade_type as grade_type, - grades.scaled_score as scaled_score, - grades.grade_bucket as grade_bucket -from grades -join most_recent_grades using (org, course_key, entity_id, actor_id, emission_time) diff --git a/tutoraspects/templates/openedx-assets/queries/fact_enrollments_by_day.sql b/tutoraspects/templates/openedx-assets/queries/fact_enrollments_by_day.sql deleted file mode 100644 index c41f9e9d2..000000000 --- a/tutoraspects/templates/openedx-assets/queries/fact_enrollments_by_day.sql +++ /dev/null @@ -1,68 +0,0 @@ -with - enrollments as ({% include 'openedx-assets/queries/fact_enrollments.sql' %}), - enrollments_ranked as ( - select - emission_time, - org, - course_key, - course_name, - course_run, - actor_id, - enrollment_mode, - enrollment_status, - rank() over ( - partition by date(emission_time), org, course_name, course_run, actor_id - order by emission_time desc - ) as event_rank - from enrollments - ), - enrollment_windows as ( - select - org, - course_key, - course_name, - course_run, - actor_id, - enrollment_status, - enrollment_mode, - emission_time as window_start_at, - lagInFrame(emission_time, 1, now() + interval '1' day) over ( - partition by org, course_name, course_run, actor_id - order by emission_time desc - ) as window_end_at - from enrollments_ranked - where event_rank = 1 - ), - enrollment_window_dates as ( - select - org, - course_key, - course_name, - course_run, - actor_id, - enrollment_status, - enrollment_mode, - date_trunc('day', window_start_at) as window_start_date, - date_trunc('day', window_end_at) as window_end_date - from enrollment_windows - ) -select - date( - fromUnixTimestamp( - arrayJoin( - range( - toUnixTimestamp(window_start_date), - toUnixTimestamp(window_end_date), - 86400 - ) - ) - ) - ) as enrollment_status_date, - org, - course_key, - course_name, - course_run, - actor_id, - enrollment_status, - enrollment_mode -from enrollment_window_dates