Skip to content

Commit

Permalink
Rename latest_historical_per_workspace to objects_snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
JCZuurmond committed Oct 28, 2024
1 parent 4b7060c commit ccb3bb3
Show file tree
Hide file tree
Showing 15 changed files with 14 additions and 16 deletions.
4 changes: 1 addition & 3 deletions src/databricks/labs/ucx/progress/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ def run(self) -> None:
self._schema_deployer.deploy_schema()
self._schema_deployer.deploy_table("workflow_runs", WorkflowRun)
self._schema_deployer.deploy_table("historical", Historical)
self._schema_deployer.deploy_view(
"latest_historical_per_workspace", "queries/views/latest_historical_per_workspace.sql"
)
self._schema_deployer.deploy_view("objects_snapshot", "queries/views/objects_snapshot.sql")
logger.info("Installation completed successfully!")


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* --title 'Overall progress (%)' --width 2 */
SELECT
ROUND(100 * try_divide(COUNT_IF(SIZE(failures) = 0), COUNT(*)), 2) AS percentage
FROM ucx_catalog.multiworkspace.latest_historical_per_workspace
FROM ucx_catalog.multiworkspace.objects_snapshot
WHERE object_type IN ('ClusterInfo', 'Grant', 'JobInfo', 'PipelineInfo', 'PolicyInfo', 'Table', 'Udf')
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* --title 'UDF migration progress (%)' */
SELECT
ROUND(100 * TRY_DIVIDE(COUNT_IF(SIZE(failures) = 0), COUNT(*)), 2) AS percentage
FROM ucx_catalog.multiworkspace.latest_historical_per_workspace
FROM ucx_catalog.multiworkspace.objects_snapshot
WHERE object_type = "Udf"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* --title 'Grant migration progress (%)' */
SELECT
ROUND(100 * TRY_DIVIDE(COUNT_IF(SIZE(failures) = 0), COUNT(*)), 2) AS percentage
FROM ucx_catalog.multiworkspace.latest_historical_per_workspace
FROM ucx_catalog.multiworkspace.objects_snapshot
WHERE object_type = "Grant"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* --title 'Job migration progress (%)' */
SELECT
ROUND(100 * TRY_DIVIDE(COUNT_IF(SIZE(failures) = 0), COUNT(*)), 2) AS percentage
FROM ucx_catalog.multiworkspace.latest_historical_per_workspace
FROM ucx_catalog.multiworkspace.objects_snapshot
WHERE object_type = "JobInfo"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* --title 'Cluster migration progress (%)' */
SELECT
ROUND(100 * TRY_DIVIDE(COUNT_IF(SIZE(failures) = 0), COUNT(*)), 2) AS percentage
FROM ucx_catalog.multiworkspace.latest_historical_per_workspace
FROM ucx_catalog.multiworkspace.objects_snapshot
WHERE object_type = "ClusterInfo"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* --title 'Table migration progress (%)' --width 2 */
SELECT
ROUND(100 * TRY_DIVIDE(COUNT_IF(SIZE(failures) = 0), COUNT(*)), 2) AS percentage
FROM ucx_catalog.multiworkspace.latest_historical_per_workspace
FROM ucx_catalog.multiworkspace.objects_snapshot
WHERE object_type = "Table"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* --title 'Pipeline migration progress (%)' */
SELECT
ROUND(100 * TRY_DIVIDE(COUNT_IF(SIZE(failures) = 0), COUNT(*)), 2) AS percentage
FROM ucx_catalog.multiworkspace.latest_historical_per_workspace
FROM ucx_catalog.multiworkspace.objects_snapshot
WHERE object_type = "PipelineInfo"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* --title 'Policy migration progress (%)' */
SELECT
ROUND(100 * TRY_DIVIDE(COUNT_IF(SIZE(failures) = 0), COUNT(*)), 2) AS percentage
FROM ucx_catalog.multiworkspace.latest_historical_per_workspace
FROM ucx_catalog.multiworkspace.objects_snapshot
WHERE object_type = "PolicyInfo"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* --title 'Distinct failures per object type' --width 6 */
with failures AS (
SELECT object_type, explode(failures) AS failure
FROM ucx_catalog.multiworkspace.latest_historical_per_workspace
FROM ucx_catalog.multiworkspace.objects_snapshot
WHERE object_type IN ('ClusterInfo', 'Grant', 'JobInfo', 'PipelineInfo', 'PolicyInfo', 'Table', 'Udf')
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* --title 'Pending migration' --description 'Total number of tables and views' --height 6 */
SELECT COUNT(*) AS count
FROM ucx_catalog.multiworkspace.latest_historical_per_workspace
FROM ucx_catalog.multiworkspace.objects_snapshot
WHERE object_type = 'Table' AND array_contains(failures, 'Pending migration')
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
WITH owners_with_failures AS (
SELECT owner
FROM ucx_catalog.multiworkspace.latest_historical_per_workspace
FROM ucx_catalog.multiworkspace.objects_snapshot
WHERE object_type = 'Table' AND array_contains(failures, 'Pending migration')
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* --title 'Migrated' --description 'Total number of tables and views' --height 6 */
SELECT COUNT(*) AS count
FROM ucx_catalog.multiworkspace.latest_historical_per_workspace
FROM ucx_catalog.multiworkspace.objects_snapshot
WHERE object_type = 'Table' AND SIZE(failures) == 0
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* --title 'Overview' --description 'Tables and views migration' --width 5 */
WITH migration_statuses AS (
SELECT *
FROM ucx_catalog.multiworkspace.latest_historical_per_workspace
FROM ucx_catalog.multiworkspace.objects_snapshot
WHERE object_type = 'Table' AND SIZE(failures) == 0
)

Expand Down

0 comments on commit ccb3bb3

Please sign in to comment.