From b4b3b521f428e708c53047686c330ee734ec2944 Mon Sep 17 00:00:00 2001 From: Douglas Moore Date: Wed, 27 Mar 2024 19:01:20 -0400 Subject: [PATCH] Deploy static views needed by #1123 interactive dashboard (#1139) ## Changes Deploy views `misc_patterns_vw` and `code_patterns_vw` that should have been deployed with #1123 and fixes the `interactive` dashboard queries. ### Functionality - [ ] added relevant user documentation - [ ] added new CLI command - [ ] modified existing command: `databricks labs ucx ...` - [ ] added a new workflow - [ ] modified existing workflow: `...` - [x] added a new table - [ ] modified existing table: `...` ### Tests - [x] manually tested - [ ] added unit tests - [ ] added integration tests - [x] verified on staging environment (screenshot attached) - [ ] ![image](https://github.com/databrickslabs/ucx/assets/1122251/1e5a64cf-52f9-414b-b213-2a1dc3c58841) --- src/databricks/labs/ucx/install.py | 2 ++ .../01_0_compute_access_mode_limitation_summary.sql | 4 ++-- .../queries/assessment/interactive/03_0_cluster_summary.sql | 4 ++-- .../queries/views/{code_patterns_vw.sql => code_patterns.sql} | 0 .../queries/views/{misc_patterns_vw.sql => misc_patterns.sql} | 0 5 files changed, 6 insertions(+), 4 deletions(-) rename src/databricks/labs/ucx/queries/views/{code_patterns_vw.sql => code_patterns.sql} (100%) rename src/databricks/labs/ucx/queries/views/{misc_patterns_vw.sql => misc_patterns.sql} (100%) diff --git a/src/databricks/labs/ucx/install.py b/src/databricks/labs/ucx/install.py index b0643422e5..052747c197 100644 --- a/src/databricks/labs/ucx/install.py +++ b/src/databricks/labs/ucx/install.py @@ -95,6 +95,8 @@ def deploy_schema(sql_backend: SqlBackend, inventory_schema: str): deployer.deploy_view("objects", "queries/views/objects.sql") deployer.deploy_view("grant_detail", "queries/views/grant_detail.sql") deployer.deploy_view("table_estimates", "queries/views/table_estimates.sql") + deployer.deploy_view("misc_patterns", "queries/views/misc_patterns.sql") + deployer.deploy_view("code_patterns", "queries/views/code_patterns.sql") def extract_major_minor(version_string): diff --git a/src/databricks/labs/ucx/queries/assessment/interactive/01_0_compute_access_mode_limitation_summary.sql b/src/databricks/labs/ucx/queries/assessment/interactive/01_0_compute_access_mode_limitation_summary.sql index 6fb076ce2b..7a671bc0eb 100644 --- a/src/databricks/labs/ucx/queries/assessment/interactive/01_0_compute_access_mode_limitation_summary.sql +++ b/src/databricks/labs/ucx/queries/assessment/interactive/01_0_compute_access_mode_limitation_summary.sql @@ -24,14 +24,14 @@ iteractive_cluster_commands ( WHERE a.event_date >= DATE_SUB(CURRENT_DATE(), 90) ), misc_patterns( - SELECT commandLanguage, dbr_version_major, dbr_version_minor, dbr_type, pattern, issue FROM $inventory.misc_patterns_vw + SELECT commandLanguage, dbr_version_major, dbr_version_minor, dbr_type, pattern, issue FROM $inventory.misc_patterns ), pattern_matcher( SELECT array_except(array(p.issue, lp.issue, rv.issue,dbr_type.issue), array(null)) issues, a.* FROM iteractive_cluster_commands a - LEFT OUTER JOIN $inventory.code_patterns_vw p + LEFT OUTER JOIN $inventory.code_patterns p ON a.commandLanguage in ('python','scala') AND contains(a.commandText, p.pattern) LEFT OUTER JOIN misc_patterns lp diff --git a/src/databricks/labs/ucx/queries/assessment/interactive/03_0_cluster_summary.sql b/src/databricks/labs/ucx/queries/assessment/interactive/03_0_cluster_summary.sql index 1df77f87eb..a46d89ccbe 100644 --- a/src/databricks/labs/ucx/queries/assessment/interactive/03_0_cluster_summary.sql +++ b/src/databricks/labs/ucx/queries/assessment/interactive/03_0_cluster_summary.sql @@ -25,14 +25,14 @@ iteractive_cluster_commands ( WHERE a.event_date >= DATE_SUB(CURRENT_DATE(), 90) ), misc_patterns( - SELECT commandLanguage, dbr_version_major, dbr_version_minor, dbr_type, pattern, issue FROM $inventory.misc_patterns_vw + SELECT commandLanguage, dbr_version_major, dbr_version_minor, dbr_type, pattern, issue FROM $inventory.misc_patterns ), pattern_matcher( SELECT explode(array_except(array(p.issue, lp.issue, rv.issue,dbr_type.issue), array(null))) issue, a.* FROM iteractive_cluster_commands a - LEFT OUTER JOIN $inventory.code_patterns_vw p + LEFT OUTER JOIN $inventory.code_patterns p ON a.commandLanguage in ('python','scala') AND contains(a.commandText, p.pattern) LEFT OUTER JOIN misc_patterns lp diff --git a/src/databricks/labs/ucx/queries/views/code_patterns_vw.sql b/src/databricks/labs/ucx/queries/views/code_patterns.sql similarity index 100% rename from src/databricks/labs/ucx/queries/views/code_patterns_vw.sql rename to src/databricks/labs/ucx/queries/views/code_patterns.sql diff --git a/src/databricks/labs/ucx/queries/views/misc_patterns_vw.sql b/src/databricks/labs/ucx/queries/views/misc_patterns.sql similarity index 100% rename from src/databricks/labs/ucx/queries/views/misc_patterns_vw.sql rename to src/databricks/labs/ucx/queries/views/misc_patterns.sql