11{{ config(
2- materialized= ' incremental'
3- ,unique_key= [' week' ,' channel_title' ]
2+ materialized= ' incremental' ,
3+ unique_key= [' week' ,' channel_title' ],
4+ on_schema_change= ' append_new_columns'
45 )
56}}
67
@@ -18,7 +19,6 @@ WITH program_durations AS (
1819 FROM public .program_metadata pm
1920 WHERE pm .country = ' france'
2021),
21-
2222program_weeks AS (
2323 SELECT
2424 pd .channel_title ,
@@ -32,7 +32,6 @@ program_weeks AS (
3232 )::date AS week_start
3333 FROM program_durations pd
3434),
35-
3635program_airings AS (
3736 SELECT
3837 channel_title,
@@ -43,7 +42,6 @@ program_airings AS (
4342 week_start
4443 FROM program_weeks
4544),
46-
4745weekly_program_durations AS (
4846 SELECT
4947 channel_title,
@@ -52,7 +50,6 @@ weekly_program_durations AS (
5250 FROM program_airings
5351 GROUP BY channel_title, week_start
5452),
55-
5653keyword_occurrences AS (
5754 SELECT DISTINCT
5855 COALESCE(pm .channel_title , k .channel_title ) AS channel_title,
@@ -92,8 +89,6 @@ keyword_occurrences AS (
9289 LOWER (kw - >> ' theme' ) NOT LIKE ' %indirect%'
9390 AND k .country = ' france'
9491)
95-
96-
9792SELECT
9893 ko .channel_title ,
9994 ko .week ,
@@ -121,11 +116,10 @@ SELECT
121116FROM keyword_occurrences ko
122117LEFT JOIN public .dictionary d
123118 ON d .keyword = ko .keyword AND d .theme LIKE ko .theme || ' %' -- ensure matc with indirect theme inside the dictionary table
124-
125119LEFT JOIN weekly_program_durations wpd
126120 ON wpd .channel_title = ko .channel_title AND wpd .week = ko .week
127121LEFT JOIN public .keyword_macro_category kmc
128- ON kmc .keyword = ko .keyword
122+ ON kmc .keyword ilike ko .keyword
129123GROUP BY
130124 ko .channel_title ,
131125 ko .week ,
0 commit comments