From 8a9ab5a7fdf48058e432b0f1231847569102d7a0 Mon Sep 17 00:00:00 2001 From: Lennart Kats Date: Sun, 21 Jan 2024 22:51:52 +0100 Subject: [PATCH 1/2] Show details with connection errors --- CHANGELOG.md | 1 + dbt/adapters/databricks/connections.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac59175f7..54363b3e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Fixed Hive performance regression by streamlining materialization type acquisition ([557](https://github.com/databricks/dbt-databricks/pull/557)) - Fix: Python models authentication could be overridden by a `.netrc` file in the user's home directory ([338](https://github.com/databricks/dbt-databricks/pull/338)) - Fix: MV/ST REST api authentication could be overriden by a `.netrc` file in the user's home directory ([555](https://github.com/databricks/dbt-databricks/pull/555)) +- Show details in connection errors ([562](https://github.com/databricks/dbt-databricks/pull/562)) ### Under the Hood diff --git a/dbt/adapters/databricks/connections.py b/dbt/adapters/databricks/connections.py index b696fb453..0d1ce29f2 100644 --- a/dbt/adapters/databricks/connections.py +++ b/dbt/adapters/databricks/connections.py @@ -1486,7 +1486,7 @@ def _get_table_view_pipeline_id(session: Session, host: str, name: str) -> str: resp1 = session.get(table_url) if resp1.status_code != 200: raise dbt.exceptions.DbtRuntimeError( - f"Error getting info for materialized view/streaming table: {name}" + f"Error getting info for materialized view/streaming table {name}: {resp1.text}" ) pipeline_id = resp1.json().get("pipeline_id", "") @@ -1503,7 +1503,7 @@ def _get_pipeline_state(session: Session, host: str, pipeline_id: str) -> dict: response = session.get(pipeline_url) if response.status_code != 200: - raise dbt.exceptions.DbtRuntimeError(f"Error getting pipeline info: {pipeline_id}") + raise dbt.exceptions.DbtRuntimeError(f"Error getting pipeline info for {pipeline_id}: {response.text}") return response.json() @@ -1529,7 +1529,7 @@ def _get_update_error_msg(session: Session, host: str, pipeline_id: str, update_ events_url = f"https://{host}/api/2.0/pipelines/{pipeline_id}/events" response = session.get(events_url) if response.status_code != 200: - raise dbt.exceptions.DbtRuntimeError(f"Error getting pipeline event info: {pipeline_id}") + raise dbt.exceptions.DbtRuntimeError(f"Error getting pipeline event info for {pipeline_id}: {response.text}") events = response.json().get("events", []) update_events = [ From c656b0f02517075ed87c32107e2ddcf414af128c Mon Sep 17 00:00:00 2001 From: Lennart Kats Date: Mon, 22 Jan 2024 12:23:31 +0100 Subject: [PATCH 2/2] Reformat --- dbt/adapters/databricks/connections.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dbt/adapters/databricks/connections.py b/dbt/adapters/databricks/connections.py index 0d1ce29f2..c7fc20182 100644 --- a/dbt/adapters/databricks/connections.py +++ b/dbt/adapters/databricks/connections.py @@ -1503,7 +1503,9 @@ def _get_pipeline_state(session: Session, host: str, pipeline_id: str) -> dict: response = session.get(pipeline_url) if response.status_code != 200: - raise dbt.exceptions.DbtRuntimeError(f"Error getting pipeline info for {pipeline_id}: {response.text}") + raise dbt.exceptions.DbtRuntimeError( + f"Error getting pipeline info for {pipeline_id}: {response.text}" + ) return response.json() @@ -1529,7 +1531,9 @@ def _get_update_error_msg(session: Session, host: str, pipeline_id: str, update_ events_url = f"https://{host}/api/2.0/pipelines/{pipeline_id}/events" response = session.get(events_url) if response.status_code != 200: - raise dbt.exceptions.DbtRuntimeError(f"Error getting pipeline event info for {pipeline_id}: {response.text}") + raise dbt.exceptions.DbtRuntimeError( + f"Error getting pipeline event info for {pipeline_id}: {response.text}" + ) events = response.json().get("events", []) update_events = [