Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/main/resources/db_scripts/create_analysis_transforms.sql
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,14 @@ CREATE TABLE anonymous.teacher_engagement_v2_events AS
OR event_type = 'VIEW_HINT' AND event_details ->> 'hintIndex' = '0'
)
UNION
(SELECT user_id, timestamp from anonymous.workshop_join_events);
(SELECT user_id, timestamp from anonymous.workshop_join_events);

CREATE TABLE anonymous.england_scotland_state_schools_v2 AS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine to create a new table, but it won't inherit the indices of its base table. Whilst we don't want the indices created unnecessarily during the initial initialisation of the anon database (before sending), we may want to add an index and primary key to this table elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, we usually do that here - thanks for reminding me.

SELECT *
FROM anonymous.schools_2024 as schools
WHERE
-- Scottish school info comes from schools_2024 - we need to filter for LA-run schools.
(schools.school_type_group = 'Local Authority' AND schools.data_source IN ('GOVERNMENT_SCO'))
-- For English schools, we have a pre-prepared table of state schools. Additionally, we want to include Colleges.
OR urn IN (SELECT urn FROM anonymous.schools_2024_english_state)
OR schools.school_type_group = 'Colleges'
Loading