Skip to content

Commit

Permalink
Merge branch 'main' into 1.7.latest
Browse files Browse the repository at this point in the history
  • Loading branch information
benc-db committed May 16, 2024
2 parents 40ffcd6 + 7873a6d commit 0173013
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## dbt-databricks 1.7.15 (TBD)
## dbt-databricks 1.7.15 (May 16, 2024)

### Fixes

- Give sensible logs when connection errors ([666](https://github.com/databricks/dbt-databricks/pull/666))

## dbt-databricks 1.7.14 (May 1, 2024)

Expand Down
16 changes: 8 additions & 8 deletions dbt/adapters/databricks/events/connection_events.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from abc import ABC
from typing import Any
from typing import Optional
from typing import Tuple

from databricks.sql.client import Connection
from dbt.adapters.databricks.events.base import SQLErrorEvent
from dbt.contracts.graph.nodes import ResultNode


class ConnectionEvent(ABC):
def __init__(self, connection: Connection, message: str):
def __init__(self, connection: Optional[Connection], message: str):
self.message = message
self.session_id = "Unknown"
if connection:
Expand All @@ -19,31 +19,31 @@ def __str__(self) -> str:


class ConnectionCancel(ConnectionEvent):
def __init__(self, connection: Connection):
def __init__(self, connection: Optional[Connection]):
super().__init__(connection, "Cancelling connection")


class ConnectionClose(ConnectionEvent):
def __init__(self, connection: Connection):
def __init__(self, connection: Optional[Connection]):
super().__init__(connection, "Closing connection")


class ConnectionCancelError(ConnectionEvent):
def __init__(self, connection: Connection, exception: Exception):
def __init__(self, connection: Optional[Connection], exception: Exception):
super().__init__(
connection, str(SQLErrorEvent(exception, "Exception while trying to cancel connection"))
)


class ConnectionCloseError(ConnectionEvent):
def __init__(self, connection: Connection, exception: Exception):
def __init__(self, connection: Optional[Connection], exception: Exception):
super().__init__(
connection, str(SQLErrorEvent(exception, "Exception while trying to close connection"))
)


class ConnectionCreateError(ConnectionEvent):
def __init__(self, connection: Connection, exception: Exception):
def __init__(self, connection: Optional[Connection], exception: Exception):
super().__init__(
connection, str(SQLErrorEvent(exception, "Exception while trying to create connection"))
)
Expand All @@ -62,7 +62,7 @@ class ConnectionAcquire(ConnectionWrapperEvent):
def __init__(
self,
description: str,
model: Optional[ResultNode],
model: Optional[Any],
compute_name: Optional[str],
thread_identifier: Tuple[int, int],
):
Expand Down

0 comments on commit 0173013

Please sign in to comment.