Skip to content

Fix dashboard serialisation: query is now queryLines on upstream REST API#491

Open
asnare wants to merge 4 commits intomainfrom
fix/dataset-model
Open

Fix dashboard serialisation: query is now queryLines on upstream REST API#491
asnare wants to merge 4 commits intomainfrom
fix/dataset-model

Conversation

@asnare
Copy link
Contributor

@asnare asnare commented Mar 6, 2026

This PR updates the way we load datasets from dashboards via the API:

  • Previously the JSON for a dataset included a query attribute in the response, whereas now it returns queryLines containing an array of the query lines.
  • The upstream API still accepts query for compatibility when writing, but converts it to queryLines on fetch.

For compatibility this change retains the use of query (formatted via SQLGlot) in the saved dashboards.

An integration test has been added to cover .save_to_folder(): this was previously missing but there was no integration test.

Related issues:

As an incidental change, Hatch is upgraded from 1.9.4 to 1.16.5: this is necessary because 1.9.4 no longer works, and without Hatch the CI/CD cannot run.

asnare added 2 commits March 6, 2026 15:45
Serialized dashboards now return the query as an array of lines in the `queryLines` attribute.
@asnare asnare self-assigned this Mar 6, 2026
@asnare asnare added the bug Something isn't working label Mar 6, 2026
@asnare asnare added this to UCX Mar 6, 2026
@asnare asnare moved this to Ready for Review in UCX Mar 6, 2026
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

❌ 36/37 passed, 1 failed, 4 skipped, 4m32s total

❌ test_runtime_backend_errors_handled[\nfrom databricks.labs.lsql.backends import RuntimeBackend\nfrom databricks.sdk.errors import Unknown\nbackend = RuntimeBackend()\ntry:\n grants = backend.fetch("SHOW GRANTS ON METASTORE")\n print("FAILED")\nexcept Unknown:\n print("PASSED")\n]: ValueError: TEST_SCHEMA auth: metadata-service: HTTPConnectionPool(host='127.0.0.1', port=33719): Read timed out. (read timeout=10). Config: host=https://DATABRICKS_HOST, CLOUD_ENV_client_id=4106dc97-a963-48f0-a079-a578238959a6, CLOUD_ENV_tenant_id=9f37a392-f0ae-4280-9796-f1864a10effc, auth_type=metadata-service, cluster_id=DATABRICKS_CLUSTER_ID, warehouse_id=DATABRICKS_WAREHOUSE_ID, metadata_service_url=***. Env: DATABRICKS_HOST, ARM_CLIENT_ID, ARM_TENANT_ID, DATABRICKS_AUTH_TYPE, DATABRICKS_CLUSTER_ID, DATABRICKS_WAREHOUSE_ID, DATABRICKS_METADATA_SERVICE_URL (10.003s)
ValueError: TEST_SCHEMA auth: metadata-service: HTTPConnectionPool(host='127.0.0.1', port=33719): Read timed out. (read timeout=10). Config: host=https://DATABRICKS_HOST, CLOUD_ENV_client_id=4106dc97-a963-48f0-a079-a578238959a6, CLOUD_ENV_tenant_id=9f37a392-f0ae-4280-9796-f1864a10effc, auth_type=metadata-service, cluster_id=DATABRICKS_CLUSTER_ID, warehouse_id=DATABRICKS_WAREHOUSE_ID, metadata_service_url=***. Env: DATABRICKS_HOST, ARM_CLIENT_ID, ARM_TENANT_ID, DATABRICKS_AUTH_TYPE, DATABRICKS_CLUSTER_ID, DATABRICKS_WAREHOUSE_ID, DATABRICKS_METADATA_SERVICE_URL
16:02 DEBUG [databricks.sdk] Loaded from environment
16:02 DEBUG [databricks.sdk] Ignoring pat auth, because metadata-service is preferred
16:02 DEBUG [databricks.sdk] Ignoring basic auth, because metadata-service is preferred
16:02 DEBUG [databricks.sdk] Attempting to configure auth: metadata-service
16:02 DEBUG [databricks.sdk] Loaded from environment
16:02 DEBUG [databricks.sdk] Ignoring pat auth, because metadata-service is preferred
16:02 DEBUG [databricks.sdk] Ignoring basic auth, because metadata-service is preferred
16:02 DEBUG [databricks.sdk] Attempting to configure auth: metadata-service
[gw7] linux -- Python 3.10.19 /home/runner/work/lsql/lsql/.venv/bin/python

Running from acceptance #552

Hatch 1.9.4 does not work with the current version of pip.
@asnare
Copy link
Contributor Author

asnare commented Mar 6, 2026

❌ 36/37 passed, 1 failed, 4 skipped, 4m32s total

❌ test_runtime_backend_errors_handled[\nfrom databricks.labs.lsql.backends import RuntimeBackend\nfrom databricks.sdk.errors import Unknown\nbackend = RuntimeBackend()\ntry:\n grants = backend.fetch("SHOW GRANTS ON METASTORE")\n print("FAILED")\nexcept Unknown:\n print("PASSED")\n]: ValueError: TEST_SCHEMA auth: metadata-service: HTTPConnectionPool(host='127.0.0.1', port=33719): Read timed out. (read timeout=10). Config: host=https://DATABRICKS_HOST, CLOUD_ENV_client_id=4106dc97-a963-48f0-a079-a578238959a6, CLOUD_ENV_tenant_id=9f37a392-f0ae-4280-9796-f1864a10effc, auth_type=metadata-service, cluster_id=DATABRICKS_CLUSTER_ID, warehouse_id=DATABRICKS_WAREHOUSE_ID, metadata_service_url=***. Env: DATABRICKS_HOST, ARM_CLIENT_ID, ARM_TENANT_ID, DATABRICKS_AUTH_TYPE, DATABRICKS_CLUSTER_ID, DATABRICKS_WAREHOUSE_ID, DATABRICKS_METADATA_SERVICE_URL (10.003s)
Running from acceptance #552

This is a test that is failing on main, and unrelated to this PR. (It is addressed by #492.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Ready for Review

1 participant