Skip to content

Commit 7a7366f

Browse files
committed
Add replace catalog functionality to create-dashboard command
1 parent 15a23a8 commit 7a7366f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fmt = ["isort .",
7272
"mypy .",
7373
"pylint --output-format=colorized -j 0 src"]
7474
verify = ["isort . --check-only",
75-
"ruff .",
75+
"ruff check .",
7676
"mypy .",
7777
"pylint --output-format=colorized -j 0 src"]
7878

src/databricks/labs/lsql/cli.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@ def create_dashboard(
1616
w: WorkspaceClient,
1717
folder: Path = Path.cwd(),
1818
*,
19+
catalog: str = "",
1920
database: str = "",
2021
no_open: bool = False,
2122
):
2223
"""Create a dashboard from queries"""
2324
logger.debug("Creating dashboard ...")
2425
lakeview_dashboards = Dashboards(w)
2526
folder = Path(folder)
26-
dashboard_metadata = DashboardMetadata.from_path(folder)
27-
if database:
28-
dashboard_metadata = dashboard_metadata.replace_database(database)
27+
dashboard_metadata = DashboardMetadata.from_path(folder).replace_database(
28+
catalog=catalog or None, database=database or None
29+
)
2930
lakeview_dashboard = lakeview_dashboards.create_dashboard(dashboard_metadata)
3031
sdk_dashboard = lakeview_dashboards.deploy_dashboard(lakeview_dashboard)
3132
dashboard_url = f"{w.config.host}/sql/dashboardsv3/{sdk_dashboard.dashboard_id}"

0 commit comments

Comments
 (0)