databrickslabs / lsql

Lightweight SQL execution wrapper only on top of Databricks SDK
https://pypi.org/project/databricks-labs-lsql/
Other
7 stars 1 forks source link

[TECH DEBT] Handling tile id collissions #199

Closed JCZuurmond closed 6 days ago

JCZuurmond commented 2 weeks ago

See test below:

def test_dashboards_creates_dashboard_with_id_collisions(tmp_path):
    ws = create_autospec(WorkspaceClient)

    dashboard_content = """
display_name: Id collisions

tiles:
  counter:
    width: 10
""".lstrip()
    (tmp_path / "dashboard.yml").write_text(dashboard_content)
    (tmp_path / "counter.md").write_text("# Description")
    (tmp_path / "counter.sql").write_text("SELECT 100 AS count")
    (tmp_path / "header_overwrite.sql").write_text("-- --id counter\nSELECT 100 AS count")

    lakeview_dashboard = Dashboards(ws).create_dashboard(tmp_path)
    layout = lakeview_dashboard.pages[0].layout

    assert len(layout) == 3
    assert all(l.position.width == 10 for l in layout)
    ws.assert_not_called()

How do we want to handle these collisions from a user perspective?

Considerations:

With id collisions the metadata is applied to all tiles with the same id, which is confusing when the metadata is defined in file headers

_Originally posted by @JCZuurmond in https://github.com/databrickslabs/lsql/pull/198#discussion_r1654847452_

JCZuurmond commented 6 days ago

Resolved in #208