diff --git a/analytics_data_api/insights_snowflake/toggles.py b/analytics_data_api/insights_snowflake/toggles.py index 39f7dc14..135b7f6e 100644 --- a/analytics_data_api/insights_snowflake/toggles.py +++ b/analytics_data_api/insights_snowflake/toggles.py @@ -4,6 +4,10 @@ INSIGHTS_SNOWFLAKE_FLAG = 'insights_snowflake_enabled' COURSE_ACTIVITY_SNOWFLAKE_FLAG = 'insights_snowflake_course_activity' +ENROLLMENT_SNOWFLAKE_FLAG = 'insights_snowflake_enrollment_enabled' +COURSE_SUMMARIES_SNOWFLAKE_FLAG = 'insights_snowflake_course_summaries_enabled' +ENGAGEMENT_SNOWFLAKE_FLAG = 'insights_snowflake_engagement_enabled' +PERFORMANCE_SNOWFLAKE_FLAG = 'insights_snowflake_performance_enabled' def is_insights_snowflake_enabled(request): @@ -11,9 +15,34 @@ def is_insights_snowflake_enabled(request): return flag_is_active(request, INSIGHTS_SNOWFLAKE_FLAG) +def is_insights_snowflake_group_enabled(request, group_flag): + """Return whether the global switch and a specific group switch are active.""" + return is_insights_snowflake_enabled(request) and flag_is_active(request, group_flag) + + +def is_enrollment_snowflake_enabled(request): + """Return whether enrollment endpoints should read from Snowflake.""" + return is_insights_snowflake_group_enabled(request, ENROLLMENT_SNOWFLAKE_FLAG) + + +def is_course_summaries_snowflake_enabled(request): + """Return whether course summary endpoints should read from Snowflake.""" + return is_insights_snowflake_group_enabled(request, COURSE_SUMMARIES_SNOWFLAKE_FLAG) + + +def is_engagement_snowflake_enabled(request): + """Return whether engagement endpoints should read from Snowflake.""" + return is_insights_snowflake_group_enabled(request, ENGAGEMENT_SNOWFLAKE_FLAG) + + +def is_performance_snowflake_enabled(request): + """Return whether performance endpoints should read from Snowflake.""" + return is_insights_snowflake_group_enabled(request, PERFORMANCE_SNOWFLAKE_FLAG) + + def is_course_activity_snowflake_enabled(request): """Return whether course activity should be read from Snowflake.""" - return ( - is_insights_snowflake_enabled(request) or - flag_is_active(request, COURSE_ACTIVITY_SNOWFLAKE_FLAG) + return is_insights_snowflake_enabled(request) and ( + flag_is_active(request, COURSE_ACTIVITY_SNOWFLAKE_FLAG) or + flag_is_active(request, ENGAGEMENT_SNOWFLAKE_FLAG) ) diff --git a/analytics_data_api/tests/test_insights_snowflake.py b/analytics_data_api/tests/test_insights_snowflake.py index 9ef276dc..ba85035d 100644 --- a/analytics_data_api/tests/test_insights_snowflake.py +++ b/analytics_data_api/tests/test_insights_snowflake.py @@ -81,9 +81,12 @@ ) from analytics_data_api.insights_snowflake.toggles import ( COURSE_ACTIVITY_SNOWFLAKE_FLAG, + ENGAGEMENT_SNOWFLAKE_FLAG, INSIGHTS_SNOWFLAKE_FLAG, is_course_activity_snowflake_enabled, + is_engagement_snowflake_enabled, is_insights_snowflake_enabled, + is_insights_snowflake_group_enabled, ) from analytics_data_api.snowflake_client import SnowflakeConfigurationError @@ -1237,25 +1240,56 @@ def test_is_insights_snowflake_enabled_uses_global_flag(self, mock_flag_is_activ mock_flag_is_active.assert_called_once_with(request, INSIGHTS_SNOWFLAKE_FLAG) + @patch('analytics_data_api.insights_snowflake.toggles.flag_is_active') + def test_group_flag_requires_global_flag(self, mock_flag_is_active): + request = Mock() + mock_flag_is_active.return_value = False + + self.assertFalse(is_insights_snowflake_group_enabled(request, ENGAGEMENT_SNOWFLAKE_FLAG)) + + mock_flag_is_active.assert_called_once_with(request, INSIGHTS_SNOWFLAKE_FLAG) + + @patch('analytics_data_api.insights_snowflake.toggles.flag_is_active') + def test_group_flag_requires_group_flag(self, mock_flag_is_active): + request = Mock() + mock_flag_is_active.side_effect = [True, False] + + self.assertFalse(is_insights_snowflake_group_enabled(request, ENGAGEMENT_SNOWFLAKE_FLAG)) + + self.assertEqual(mock_flag_is_active.call_args_list[0].args, (request, INSIGHTS_SNOWFLAKE_FLAG)) + self.assertEqual(mock_flag_is_active.call_args_list[1].args, (request, ENGAGEMENT_SNOWFLAKE_FLAG)) + + @patch('analytics_data_api.insights_snowflake.toggles.flag_is_active') + def test_engagement_group_flag_uses_global_and_group_flags(self, mock_flag_is_active): + request = Mock() + mock_flag_is_active.side_effect = [True, True] + + self.assertTrue(is_engagement_snowflake_enabled(request)) + + self.assertEqual(mock_flag_is_active.call_args_list[0].args, (request, INSIGHTS_SNOWFLAKE_FLAG)) + self.assertEqual(mock_flag_is_active.call_args_list[1].args, (request, ENGAGEMENT_SNOWFLAKE_FLAG)) + @patch('analytics_data_api.insights_snowflake.toggles.flag_is_active') def test_is_course_activity_snowflake_enabled_uses_global_flag(self, mock_flag_is_active): request = Mock() - mock_flag_is_active.return_value = True + mock_flag_is_active.side_effect = [True, True] self.assertTrue(is_course_activity_snowflake_enabled(request)) - mock_flag_is_active.assert_called_once_with(request, INSIGHTS_SNOWFLAKE_FLAG) + self.assertEqual(mock_flag_is_active.call_args_list[0].args, (request, INSIGHTS_SNOWFLAKE_FLAG)) + self.assertEqual(mock_flag_is_active.call_args_list[1].args, (request, COURSE_ACTIVITY_SNOWFLAKE_FLAG)) @patch('analytics_data_api.insights_snowflake.toggles.flag_is_active') def test_is_course_activity_snowflake_enabled_uses_endpoint_flag(self, mock_flag_is_active): request = Mock() - mock_flag_is_active.side_effect = [False, True] + mock_flag_is_active.side_effect = [True, False, True] self.assertTrue(is_course_activity_snowflake_enabled(request)) - self.assertEqual(mock_flag_is_active.call_count, 2) + self.assertEqual(mock_flag_is_active.call_count, 3) self.assertEqual(mock_flag_is_active.call_args_list[0].args, (request, INSIGHTS_SNOWFLAKE_FLAG)) self.assertEqual(mock_flag_is_active.call_args_list[1].args, (request, COURSE_ACTIVITY_SNOWFLAKE_FLAG)) + self.assertEqual(mock_flag_is_active.call_args_list[2].args, (request, ENGAGEMENT_SNOWFLAKE_FLAG)) @patch('analytics_data_api.insights_snowflake.toggles.flag_is_active') def test_is_course_activity_snowflake_enabled_returns_false_when_flags_disabled(self, mock_flag_is_active): @@ -1264,6 +1298,4 @@ def test_is_course_activity_snowflake_enabled_returns_false_when_flags_disabled( self.assertFalse(is_course_activity_snowflake_enabled(request)) - self.assertEqual(mock_flag_is_active.call_count, 2) - self.assertEqual(mock_flag_is_active.call_args_list[0].args, (request, INSIGHTS_SNOWFLAKE_FLAG)) - self.assertEqual(mock_flag_is_active.call_args_list[1].args, (request, COURSE_ACTIVITY_SNOWFLAKE_FLAG)) + mock_flag_is_active.assert_called_once_with(request, INSIGHTS_SNOWFLAKE_FLAG) diff --git a/analytics_data_api/v0/tests/views/test_course_summaries.py b/analytics_data_api/v0/tests/views/test_course_summaries.py index bd545fc2..43bcfb83 100644 --- a/analytics_data_api/v0/tests/views/test_course_summaries.py +++ b/analytics_data_api/v0/tests/views/test_course_summaries.py @@ -281,7 +281,10 @@ def test_get_uses_aurora_when_global_snowflake_flag_disabled(self): course_id = CourseSamples.course_ids[1] self.generate_data(ids=[course_id]) - with patch('analytics_data_api.v0.views.course_summaries.is_insights_snowflake_enabled', return_value=False): + with patch( + 'analytics_data_api.v0.views.course_summaries.is_course_summaries_snowflake_enabled', + return_value=False, + ): with patch('analytics_data_api.v0.views.course_summaries.get_course_summaries') as mock_get_summaries: response = self.authenticated_get( self.path({self.ids_param: [course_id], 'exclude': ['created']}) @@ -296,7 +299,10 @@ def test_get_uses_snowflake_service_when_global_flag_enabled(self): course_id = CourseSamples.course_ids[1] snowflake_data = [self.snowflake_summary(course_id)] - with patch('analytics_data_api.v0.views.course_summaries.is_insights_snowflake_enabled', return_value=True): + with patch( + 'analytics_data_api.v0.views.course_summaries.is_course_summaries_snowflake_enabled', + return_value=True, + ): with patch( 'analytics_data_api.v0.views.course_summaries.get_course_summaries', return_value=snowflake_data, @@ -320,7 +326,10 @@ def test_post_uses_snowflake_service_with_programs_and_recent_date(self): recent = (datetime.datetime.today() - datetime.timedelta(5)).strftime('%Y-%m-%d') snowflake_data = [self.snowflake_summary(course_id, programs=True, recent_count_change=5)] - with patch('analytics_data_api.v0.views.course_summaries.is_insights_snowflake_enabled', return_value=True): + with patch( + 'analytics_data_api.v0.views.course_summaries.is_course_summaries_snowflake_enabled', + return_value=True, + ): with patch( 'analytics_data_api.v0.views.course_summaries.get_course_summaries', return_value=snowflake_data, diff --git a/analytics_data_api/v0/tests/views/test_courses.py b/analytics_data_api/v0/tests/views/test_courses.py index 45657e6c..545726e0 100644 --- a/analytics_data_api/v0/tests/views/test_courses.py +++ b/analytics_data_api/v0/tests/views/test_courses.py @@ -186,7 +186,7 @@ def test_get_with_intervals(self, course_id): def assertSnowflakeResponse(self, course_id, path, view_class, snowflake_data, expected): mock_get_data = Mock(return_value=snowflake_data) - with patch('analytics_data_api.v0.views.courses.is_insights_snowflake_enabled', return_value=True): + with patch('analytics_data_api.v0.views.courses.is_enrollment_snowflake_enabled', return_value=True): with patch.object(view_class, 'snowflake_service_function', staticmethod(mock_get_data)): response = self.authenticated_get(f'/api/v1/courses/{course_id}{path}') @@ -380,7 +380,7 @@ def test_get_returns_404_when_global_flag_enabled_and_no_snowflake_data(self): course_id = CourseSamples.course_ids[0] mock_get_data = Mock(return_value=[]) - with patch('analytics_data_api.v0.views.courses.is_insights_snowflake_enabled', return_value=True): + with patch('analytics_data_api.v0.views.courses.is_enrollment_snowflake_enabled', return_value=True): with patch.object(course_views.CourseEnrollmentView, 'snowflake_service_function', staticmethod(mock_get_data)): response = self.authenticated_get(f'/api/v1/courses/{course_id}/enrollment/') @@ -516,7 +516,7 @@ def test_get_uses_aurora_when_global_snowflake_flag_disabled(self): expected = self.format_as_response(latest_enrollment) mock_get_data = Mock() - with patch('analytics_data_api.v0.views.courses.is_insights_snowflake_enabled', return_value=False): + with patch('analytics_data_api.v0.views.courses.is_enrollment_snowflake_enabled', return_value=False): with patch.object(course_views.CourseEnrollmentView, 'snowflake_service_function', staticmethod(mock_get_data)): response = self.authenticated_get(f'/api/v1/courses/{course_id}/enrollment/') @@ -939,7 +939,7 @@ def test_get_uses_aurora_when_global_snowflake_flag_disabled(self): created=created, ) - with patch('analytics_data_api.v0.views.courses.is_insights_snowflake_enabled', return_value=False): + with patch('analytics_data_api.v0.views.courses.is_performance_snowflake_enabled', return_value=False): with patch('analytics_data_api.v0.views.courses.get_course_problems') as mock_get_problems: response = self._get_data(course_id) @@ -965,7 +965,7 @@ def test_get_uses_snowflake_service_when_global_flag_enabled(self): 'created': created.strftime(settings.DATETIME_FORMAT), }] - with patch('analytics_data_api.v0.views.courses.is_insights_snowflake_enabled', return_value=True): + with patch('analytics_data_api.v0.views.courses.is_performance_snowflake_enabled', return_value=True): with patch( 'analytics_data_api.v0.views.courses.get_course_problems', return_value=snowflake_data, @@ -980,7 +980,7 @@ def test_get_uses_snowflake_service_when_global_flag_enabled(self): def test_get_returns_404_when_snowflake_service_returns_no_data(self): course_id = CourseSamples.course_ids[0] - with patch('analytics_data_api.v0.views.courses.is_insights_snowflake_enabled', return_value=True): + with patch('analytics_data_api.v0.views.courses.is_performance_snowflake_enabled', return_value=True): with patch( 'analytics_data_api.v0.views.courses.get_course_problems', return_value=[], @@ -1147,7 +1147,7 @@ def test_get_uses_aurora_when_global_snowflake_flag_disabled(self): pipeline_video_id=video_id, duration=100, segment_length=1, users_at_start=50, users_at_end=10, created=created) - with patch('analytics_data_api.v0.views.courses.is_insights_snowflake_enabled', return_value=False), \ + with patch('analytics_data_api.v0.views.courses.is_engagement_snowflake_enabled', return_value=False), \ patch('analytics_data_api.v0.views.courses.get_course_videos') as mock_get_videos: response = self._get_data(course_id) @@ -1177,7 +1177,7 @@ def test_get_uses_snowflake_service_when_global_flag_enabled(self): 'created': created.strftime(settings.DATETIME_FORMAT), }] - with patch('analytics_data_api.v0.views.courses.is_insights_snowflake_enabled', return_value=True): + with patch('analytics_data_api.v0.views.courses.is_engagement_snowflake_enabled', return_value=True): with patch( 'analytics_data_api.v0.views.courses.get_course_videos', return_value=snowflake_data, @@ -1192,7 +1192,7 @@ def test_get_uses_snowflake_service_when_global_flag_enabled(self): def test_get_returns_404_when_snowflake_service_returns_no_data(self): course_id = CourseSamples.course_ids[0] - with patch('analytics_data_api.v0.views.courses.is_insights_snowflake_enabled', return_value=True): + with patch('analytics_data_api.v0.views.courses.is_engagement_snowflake_enabled', return_value=True): with patch( 'analytics_data_api.v0.views.courses.get_course_videos', return_value=[], diff --git a/analytics_data_api/v0/tests/views/test_problems.py b/analytics_data_api/v0/tests/views/test_problems.py index a5015449..2c823427 100644 --- a/analytics_data_api/v0/tests/views/test_problems.py +++ b/analytics_data_api/v0/tests/views/test_problems.py @@ -147,7 +147,7 @@ def test_get_404(self): self.assertEqual(response.status_code, 404) def test_get_uses_aurora_when_global_snowflake_flag_disabled(self): - with patch('analytics_data_api.v0.views.problems.is_insights_snowflake_enabled', return_value=False): + with patch('analytics_data_api.v0.views.problems.is_performance_snowflake_enabled', return_value=False): with patch( 'analytics_data_api.v0.views.problems.get_problem_answer_distribution', ) as mock_get_answer_distribution: @@ -190,7 +190,7 @@ def test_get_uses_snowflake_service_when_global_flag_enabled(self): ), ] - with patch('analytics_data_api.v0.views.problems.is_insights_snowflake_enabled', return_value=True): + with patch('analytics_data_api.v0.views.problems.is_performance_snowflake_enabled', return_value=True): with patch( 'analytics_data_api.v0.views.problems.get_problem_answer_distribution', return_value=snowflake_data, @@ -207,7 +207,7 @@ def test_get_uses_snowflake_service_when_global_flag_enabled(self): mock_get_answer_distribution.assert_called_once_with(self.module_id1) def test_get_returns_404_when_snowflake_service_returns_no_data(self): - with patch('analytics_data_api.v0.views.problems.is_insights_snowflake_enabled', return_value=True): + with patch('analytics_data_api.v0.views.problems.is_performance_snowflake_enabled', return_value=True): with patch( 'analytics_data_api.v0.views.problems.get_problem_answer_distribution', return_value=[], diff --git a/analytics_data_api/v0/tests/views/test_programs.py b/analytics_data_api/v0/tests/views/test_programs.py index 58b7fc32..8a8cf908 100644 --- a/analytics_data_api/v0/tests/views/test_programs.py +++ b/analytics_data_api/v0/tests/views/test_programs.py @@ -112,7 +112,7 @@ def test_get_uses_aurora_when_global_snowflake_flag_disabled(self): program_id = CourseSamples.program_ids[0] self.generate_data(ids=[program_id]) - with patch('analytics_data_api.v0.views.programs.is_insights_snowflake_enabled', return_value=False): + with patch('analytics_data_api.v0.views.programs.is_course_summaries_snowflake_enabled', return_value=False): with patch('analytics_data_api.v0.views.programs.get_program_metadata') as mock_get_program_metadata: response = self.authenticated_get(f'/api/v0/programs/?program_ids={program_id}&exclude=created') @@ -131,7 +131,7 @@ def test_get_uses_snowflake_service_when_global_flag_enabled(self): 'course_ids': [self.course_id], }] - with patch('analytics_data_api.v0.views.programs.is_insights_snowflake_enabled', return_value=True): + with patch('analytics_data_api.v0.views.programs.is_course_summaries_snowflake_enabled', return_value=True): with patch( 'analytics_data_api.v0.views.programs.get_program_metadata', return_value=snowflake_data, diff --git a/analytics_data_api/v0/tests/views/test_videos.py b/analytics_data_api/v0/tests/views/test_videos.py index e9c4d83f..82cad42d 100644 --- a/analytics_data_api/v0/tests/views/test_videos.py +++ b/analytics_data_api/v0/tests/views/test_videos.py @@ -72,7 +72,7 @@ def test_get_uses_aurora_when_global_snowflake_flag_disabled(self): G(models.VideoTimeline, pipeline_video_id=video_id, segment=0, num_users=10, num_views=50, created=created) - with patch('analytics_data_api.v0.views.videos.is_insights_snowflake_enabled', return_value=False), \ + with patch('analytics_data_api.v0.views.videos.is_engagement_snowflake_enabled', return_value=False), \ patch('analytics_data_api.v0.views.videos.get_video_timeline') as mock_get_timeline: response = self._get_data(video_id) @@ -96,7 +96,7 @@ def test_get_uses_snowflake_service_when_global_flag_enabled(self): 'created': created.strftime(settings.DATETIME_FORMAT), }] - with patch('analytics_data_api.v0.views.videos.is_insights_snowflake_enabled', return_value=True): + with patch('analytics_data_api.v0.views.videos.is_engagement_snowflake_enabled', return_value=True): with patch( 'analytics_data_api.v0.views.videos.get_video_timeline', return_value=snowflake_data, @@ -111,7 +111,7 @@ def test_get_uses_snowflake_service_when_global_flag_enabled(self): def test_get_returns_404_when_snowflake_service_returns_no_data(self): video_id = 'v1d30' - with patch('analytics_data_api.v0.views.videos.is_insights_snowflake_enabled', return_value=True): + with patch('analytics_data_api.v0.views.videos.is_engagement_snowflake_enabled', return_value=True): with patch( 'analytics_data_api.v0.views.videos.get_video_timeline', return_value=[], diff --git a/analytics_data_api/v0/views/course_summaries.py b/analytics_data_api/v0/views/course_summaries.py index a5290529..73c33f9b 100644 --- a/analytics_data_api/v0/views/course_summaries.py +++ b/analytics_data_api/v0/views/course_summaries.py @@ -8,7 +8,7 @@ from analytics_data_api.constants import enrollment_modes from analytics_data_api.insights_snowflake.response_headers import InsightsDataSourceResponseMixin from analytics_data_api.insights_snowflake.service import get_course_summaries -from analytics_data_api.insights_snowflake.toggles import is_insights_snowflake_enabled +from analytics_data_api.insights_snowflake.toggles import is_course_summaries_snowflake_enabled from analytics_data_api.v0 import models, serializers from analytics_data_api.v0.views import APIListView from analytics_data_api.v0.views.utils import split_query_argument, validate_course_id @@ -262,7 +262,7 @@ def get_snowflake_queryset(self): raise Http404 def get_queryset(self): - if is_insights_snowflake_enabled(self.request): + if is_course_summaries_snowflake_enabled(self.request): self.set_insights_data_source_snowflake() return self.get_snowflake_queryset() diff --git a/analytics_data_api/v0/views/courses.py b/analytics_data_api/v0/views/courses.py index 38f8c1bb..d98b8fbc 100644 --- a/analytics_data_api/v0/views/courses.py +++ b/analytics_data_api/v0/views/courses.py @@ -28,7 +28,9 @@ ) from analytics_data_api.insights_snowflake.toggles import ( is_course_activity_snowflake_enabled, - is_insights_snowflake_enabled, + is_engagement_snowflake_enabled, + is_enrollment_snowflake_enabled, + is_performance_snowflake_enabled, ) from analytics_data_api.utils import dictfetchall, get_course_report_download_details from analytics_data_api.v0 import models, serializers @@ -322,7 +324,7 @@ def get_aurora_queryset(self): return super().get_queryset() def get_queryset(self): - if is_insights_snowflake_enabled(self.request): + if is_enrollment_snowflake_enabled(self.request): self.set_insights_data_source_snowflake() return self.get_snowflake_queryset() @@ -707,7 +709,7 @@ class ProblemsListView(InsightsDataSourceResponseMixin, BaseCourseView): @raise_404_if_none def get_queryset(self): - if is_insights_snowflake_enabled(self.request): + if is_performance_snowflake_enabled(self.request): self.set_insights_data_source_snowflake() data = get_course_problems(self.course_id) if data: @@ -849,7 +851,7 @@ class VideosListView(InsightsDataSourceResponseMixin, BaseCourseView): model = models.Video def get_queryset(self): - if is_insights_snowflake_enabled(self.request): + if is_engagement_snowflake_enabled(self.request): self.set_insights_data_source_snowflake() data = get_course_videos(self.course_id) if data: diff --git a/analytics_data_api/v0/views/problems.py b/analytics_data_api/v0/views/problems.py index e5e0da45..7ae4c320 100644 --- a/analytics_data_api/v0/views/problems.py +++ b/analytics_data_api/v0/views/problems.py @@ -11,7 +11,7 @@ from analytics_data_api.insights_snowflake.response_headers import InsightsDataSourceResponseMixin from analytics_data_api.insights_snowflake.service import get_problem_answer_distribution -from analytics_data_api.insights_snowflake.toggles import is_insights_snowflake_enabled +from analytics_data_api.insights_snowflake.toggles import is_performance_snowflake_enabled from analytics_data_api.utils import matching_tuple from analytics_data_api.v0.models import ( GradeDistribution, @@ -108,7 +108,7 @@ def get_queryset(self): """Select all the answer distribution response having to do with this usage of the problem.""" problem_id = self.kwargs.get('problem_id') - if is_insights_snowflake_enabled(self.request): + if is_performance_snowflake_enabled(self.request): self.set_insights_data_source_snowflake() self.serializer_class = ConsolidatedFirstLastAnswerDistributionSerializer queryset = get_problem_answer_distribution(problem_id) diff --git a/analytics_data_api/v0/views/programs.py b/analytics_data_api/v0/views/programs.py index fc8abeed..45fb9fc1 100644 --- a/analytics_data_api/v0/views/programs.py +++ b/analytics_data_api/v0/views/programs.py @@ -5,7 +5,7 @@ from analytics_data_api.insights_snowflake.response_headers import InsightsDataSourceResponseMixin from analytics_data_api.insights_snowflake.service import get_program_metadata -from analytics_data_api.insights_snowflake.toggles import is_insights_snowflake_enabled +from analytics_data_api.insights_snowflake.toggles import is_course_summaries_snowflake_enabled from analytics_data_api.v0 import models, serializers from analytics_data_api.v0.views import APIListView @@ -76,7 +76,7 @@ def get_snowflake_queryset(self): raise Http404 def get_queryset(self): - if is_insights_snowflake_enabled(self.request): + if is_course_summaries_snowflake_enabled(self.request): self.set_insights_data_source_snowflake() return self.get_snowflake_queryset() diff --git a/analytics_data_api/v0/views/videos.py b/analytics_data_api/v0/views/videos.py index 477f76db..4fd89fb9 100644 --- a/analytics_data_api/v0/views/videos.py +++ b/analytics_data_api/v0/views/videos.py @@ -7,7 +7,7 @@ from analytics_data_api.insights_snowflake.response_headers import InsightsDataSourceResponseMixin from analytics_data_api.insights_snowflake.service import get_video_timeline -from analytics_data_api.insights_snowflake.toggles import is_insights_snowflake_enabled +from analytics_data_api.insights_snowflake.toggles import is_engagement_snowflake_enabled from analytics_data_api.v0.models import VideoTimeline from analytics_data_api.v0.serializers import VideoTimelineSerializer from analytics_data_api.v0.views.utils import raise_404_if_none @@ -46,7 +46,7 @@ def get_snowflake_queryset(self): @raise_404_if_none def get_queryset(self): """Select the view count for a specific module""" - if is_insights_snowflake_enabled(self.request): + if is_engagement_snowflake_enabled(self.request): self.set_insights_data_source_snowflake() return self.get_snowflake_queryset()