update dedupe logic -> much faster now
This commit is contained in:
@@ -10,9 +10,9 @@ MODEL (
|
||||
SELECT
|
||||
max(hkey) as hkey,
|
||||
commodity_code,
|
||||
commodity_name,
|
||||
max(commodity_name) as commodity_name,
|
||||
country_code,
|
||||
country_name,
|
||||
max(country_name) as country_name,
|
||||
ingest_date,
|
||||
COALESCE(SUM(CASE WHEN attribute_name = 'Production' THEN value END), 0) AS Production,
|
||||
COALESCE(SUM(CASE WHEN attribute_name = 'Imports' THEN value END), 0) AS Imports,
|
||||
@@ -47,11 +47,9 @@ WHERE attribute_name IN (
|
||||
)
|
||||
GROUP BY
|
||||
commodity_code,
|
||||
commodity_name,
|
||||
country_code,
|
||||
country_name,
|
||||
ingest_date
|
||||
ORDER BY
|
||||
commodity_name,
|
||||
country_name,
|
||||
ingest_date;
|
||||
commodity_code,
|
||||
country_code,
|
||||
ingest_date
|
||||
|
||||
Reference in New Issue
Block a user