Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy static views needed by #1123 interactive dashboard #1139

Merged
merged 2 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/databricks/labs/ucx/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,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")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this cannot be done during the main installation phase, which has to run on workspaces without UC enabled. these views rely on system schema, that does not exist yet. add a separate temporary CLI command to deploy these views and document it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nfx Please take a look at the code in these two views.
They are static SELECT FROM VALUES views to encode easy to change patterns etc.
The system.access.audit table is evaluated at open time of the dashboard. The dashboard header advises users of the requirements. Future releases can add commands to ensure system tables are turned on etc.

deployer.deploy_view("code_patterns", "queries/views/code_patterns.sql")


class WorkspaceInstaller:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading