-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "update : promoted new spreadsheet workflow."
- Loading branch information
1 parent
961b23e
commit ddb95ae
Showing
7 changed files
with
184 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,23 @@ | ||
WITH source AS ( | ||
SELECT | ||
* | ||
FROM | ||
{{ ref('stg_duckdb__lvl3') }} | ||
WHERE | ||
goal IS NOT NULL | ||
with source as ( | ||
select * from {{ ref('stg_duckdb__lvl3') }} | ||
where goal_name is not null | ||
), | ||
progress AS ( | ||
SELECT | ||
* | ||
FROM | ||
{{ ref('lvl1_lvl2_progress') }} | ||
|
||
progress as ( | ||
select * from {{ ref('lvl1_lvl2_progress') }} | ||
) | ||
SELECT | ||
|
||
select | ||
goal_id, | ||
goal AS lvl3_goal, | ||
CAST(AVG(done_progress) over (PARTITION BY goal) AS DECIMAL(10, 2)) AS lvl3_done_progress, | ||
CAST(AVG(clarify_progress) over (PARTITION BY goal) AS DECIMAL(10, 2)) AS lvl3_clarify_progress, | ||
goal_name as lvl3_goal, | ||
cast(avg(done_progress) over (partition by goal_name) as decimal(10,2)) as lvl3_done_progress, | ||
cast(avg(clarify_progress) over (partition by goal_name) as decimal(10,2)) as lvl3_clarify_progress, | ||
source.list_name, | ||
progress.done_progress AS l_done_progress, | ||
progress.clarify_progress AS l_clarify_progress | ||
FROM | ||
source | ||
LEFT JOIN progress | ||
ON source.list_name = progress.list_name | ||
ORDER BY | ||
1 | ||
progress.done_progress as l_done_progress, | ||
progress.clarify_progress as l_clarify_progress | ||
|
||
|
||
from source | ||
left join progress | ||
on source.list_name = progress.list_name | ||
order by 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
WITH source AS ( | ||
SELECT | ||
* | ||
FROM | ||
{{ ref('stg_duckdb__lvl3') }} | ||
with source as ( | ||
select * from {{ ref('lvl1_lvl2_progress') }} | ||
), | ||
|
||
map as ( | ||
select * from {{ ref('lvl3_progress') }} | ||
) | ||
SELECT | ||
* | ||
FROM | ||
source | ||
WHERE | ||
goal_id IS NULL | ||
AND list_name NOT LIKE '%-%' | ||
|
||
select source.* | ||
|
||
|
||
from source left join map on source.list_name = map.list_name | ||
where | ||
map.list_name is null | ||
and source.list_name not like '%------%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,30 @@ | ||
WITH MAP AS ( | ||
SELECT | ||
*, | ||
unnest( | ||
regexp_split_to_array( | ||
goals, | ||
',(?=(?:[^"]*"[^"]*")*[^"]*$)' | ||
) | ||
) AS goal | ||
FROM | ||
{{ ref('list_goal_mapping') }} | ||
with map as ( | ||
select * from {{ ref('list_goal_mapping') }} | ||
|
||
), | ||
goals AS ( | ||
SELECT | ||
* | ||
FROM | ||
{{ ref('init_duckdb__lvl3') }} | ||
), | ||
unmapped AS ( | ||
SELECT | ||
* | ||
FROM | ||
{{ ref("list_goal_mapping") }} | ||
WHERE | ||
goals IS NULL | ||
|
||
goals as ( | ||
select * from {{ ref('init_duckdb__lvl3') }} | ||
), | ||
joined AS ( | ||
SELECT | ||
goals.*, | ||
MAP.folder_name, | ||
MAP.list_name | ||
map.folder_name, | ||
map.list_name | ||
FROM | ||
goals | ||
LEFT JOIN MAP {# ON goals.goal like '%' || MAP.goal || '%' #} | ||
ON TRIM(goals.goal) LIKE '%' || REPLACE(TRIM(MAP.goal), '"', '') || '%' | ||
UNION ALL | ||
SELECT | ||
NULL AS goal_name, | ||
NULL AS goal_id, | ||
folder_name, | ||
list_name | ||
FROM | ||
unmapped | ||
LEFT JOIN map ON ',' || goals.goal_id || ',' LIKE '%,' || map.goal_ids || ',%' | ||
) | ||
|
||
SELECT * FROM joined | ||
UNION ALL | ||
SELECT | ||
* | ||
goals.*, | ||
map.folder_name, | ||
map.list_name | ||
FROM | ||
joined | ||
ORDER BY | ||
folder_name, | ||
list_name | ||
map | ||
LEFT JOIN | ||
goals ON ',' || goals.goal_id || ',' LIKE '%,' || map.goal_ids || ',%' | ||
WHERE | ||
goals.goal_id IS NULL |
Oops, something went wrong.