-
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.
Update workspace evaluator to V2 and add more reports
- Loading branch information
Showing
24 changed files
with
126 additions
and
76 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
Empty file.
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-- SDF STANDARD REPORT -- | ||
-- Reports the most used column classifiers in the workspace | ||
|
||
SELECT classifier, COUNT(*) AS usage_count | ||
FROM ( | ||
SELECT classifier | ||
FROM sdf.information_schema.columns, | ||
UNNEST(classifiers) AS t(classifier) | ||
) unnested | ||
GROUP BY classifier | ||
ORDER BY usage_count DESC; |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- SDF STANDARD REPORT -- | ||
-- Reports the most used table classifiers in the workspace | ||
|
||
SELECT classifier, COUNT(*) AS usage_count | ||
FROM ( | ||
SELECT classifier | ||
FROM sdf.information_schema.tables, | ||
UNNEST(classifiers) AS t(classifier) | ||
) unnested | ||
GROUP BY classifier | ||
ORDER BY usage_count DESC; | ||
|
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- SDF STANDARD REPORT -- | ||
-- Reports all unique column classifiers in the workspace | ||
|
||
SELECT DISTINCT classifier | ||
FROM sdf.information_schema.columns | ||
CROSS JOIN UNNEST(classifiers) AS t(classifier); |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- SDF STANDARD REPORT -- | ||
-- Reports all unique table classifiers in the workspace | ||
|
||
SELECT DISTINCT classifier | ||
FROM sdf.information_schema.tables | ||
CROSS JOIN UNNEST(classifiers) AS t(classifier); |
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,4 +1,3 @@ | ||
-- SDF STANDARD REPORT -- | ||
-- Reports all unused classifiers in the workspace | ||
|
||
-- HARD TO GET WITH CURRENT INFO SCHEMA DESIGN | ||
-- Requires some central table for all classifiers defined in workspace to be present |
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,27 +1,29 @@ | ||
-- SDF STANDARD REPORT -- | ||
-- Reports the percentage of columns that have descriptions | ||
|
||
|
||
WITH columns_with_description AS ( | ||
SELECT | ||
SELECT | ||
1 as idx, | ||
count(column_name) as c_desc | ||
FROM sdf.information_schema.columns AS c | ||
WHERE c.catalog_name != 'system' | ||
WHERE c.table_purpose != 'system' AND c.table_purpose != 'external-system' | ||
AND c.description IS NOT NULL | ||
), | ||
columns_with_no_description AS ( | ||
SELECT | ||
1 as idx, | ||
count(column_name) as c_no_desc | ||
FROM sdf.information_schema.columns AS c | ||
WHERE c.catalog_name != 'system' | ||
WHERE c.table_purpose != 'system' AND c.table_purpose != 'external-system' | ||
AND c.description IS NULL | ||
) | ||
|
||
SELECT | ||
c_desc as cols_w_desc, | ||
c_no_desc as cols_w_no_desc, | ||
(CAST (c_desc AS REAL) / CAST(c_no_desc AS REAL)) as col_desc_pct, | ||
CASE | ||
WHEN c_no_desc = 0 THEN 100 | ||
ELSE (CAST(c_desc AS REAL) / CAST(c_no_desc AS REAL)) * 100 | ||
END AS col_desc_pct, | ||
c_desc + c_no_desc as total_cols | ||
from columns_with_description cw join columns_with_no_description cd USING (idx) | ||
from columns_with_description cw join columns_with_no_description cd USING (idx) |
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
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- SDF STANDARD REPORT -- | ||
-- Reports all island tables in the workspace. | ||
-- Island tables do not have any upstream or downstream dependencies | ||
|
||
SELECT table_id | ||
FROM sdf.information_schema.tables | ||
WHERE LENGTH_ARRAY(tables.depends_on) = 0 | ||
AND LENGTH_ARRAY(tables.depended_on_by) = 0 | ||
AND purpose != 'system' AND purpose != 'external-system'; |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- SDF STANDARD REPORT -- | ||
-- Reports all leaf tables in the workspace. | ||
-- For all tables in the workspace, report which have | ||
-- no downstream dependencies | ||
|
||
SELECT from_table_id | ||
FROM sdf.information_schema.table_lineage | ||
WHERE table_lineage.to_table_id IS NULL; |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- SDF STANDARD REPORT -- | ||
-- Reports all middle tables in the workspace. | ||
-- For all tables in the workspace, report which have | ||
-- both upstream and downstream dependencies | ||
|
||
SELECT table_id | ||
FROM sdf.information_schema.tables | ||
WHERE LENGTH_ARRAY(tables.depends_on) != 0 | ||
AND LENGTH_ARRAY(tables.depended_on_by) != 0; |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- SDF STANDARD REPORT -- | ||
-- Reports all columns with the most direct downstream dependencies | ||
-- in descending order | ||
|
||
SELECT column_id, LENGTH_ARRAY(depended_on_by) AS downstream_dep_count | ||
FROM sdf.information_schema.columns | ||
ORDER BY downstream_dep_count DESC; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-- SDF STANDARD REPORT -- | ||
-- Reports all columns with the most direct downstream dependencies | ||
-- in descending order | ||
|
||
SELECT table_id, LENGTH_ARRAY(depended_on_by) AS downstream_dep_count | ||
FROM sdf.information_schema.tables | ||
ORDER BY downstream_dep_count DESC; |
This file was deleted.
Oops, something went wrong.
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,9 +1,9 @@ | ||
-- SDF STANDARD REPORT -- | ||
-- Reports the number of columns per table in descending order | ||
select | ||
distinct table_ref, | ||
distinct table_id, | ||
count(column_name) as num_columns | ||
from sdf.information_schema.columns as c | ||
where c.catalog_name != 'system' | ||
group by table_ref | ||
where c.table_purpose != 'system' and c.table_purpose != 'external-system' | ||
group by table_id | ||
order by num_columns desc; |
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