Skip to content

Commit

Permalink
Make server_side_parameters optional
Browse files Browse the repository at this point in the history
  • Loading branch information
JCZuurmond committed Jul 19, 2023
1 parent 0c3a172 commit ac402e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dbt/adapters/spark/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def open(cls, connection: Connection) -> Connection:
SessionConnectionWrapper,
)

handle = SessionConnectionWrapper(Connection(creds.server_side_parameters))
handle = SessionConnectionWrapper(Connection(server_side_parameters=creds.server_side_parameters))
else:
raise dbt.exceptions.DbtProfileError(
f"invalid credential method: {creds.method}"
Expand Down
10 changes: 5 additions & 5 deletions dbt/adapters/spark/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class Cursor:
https://github.com/mkleehammer/pyodbc/wiki/Cursor
"""

def __init__(self, server_side_parameters: Dict[str, Any]) -> None:
def __init__(self, *, server_side_parameters: Optional[Dict[str, Any]] = None) -> None:
self._df: Optional[DataFrame] = None
self._rows: Optional[List[Row]] = None
self.server_side_parameters = server_side_parameters
self.server_side_parameters = server_side_parameters or {}

def __enter__(self) -> Cursor:
return self
Expand Down Expand Up @@ -165,8 +165,8 @@ class Connection:
https://github.com/mkleehammer/pyodbc/wiki/Connection
"""

def __init__(self, server_side_parameters: Dict[Any, str]) -> None:
self.server_side_parameters = server_side_parameters
def __init__(self, *, server_side_parameters: Optional[Dict[Any, str]] = None) -> None:
self.server_side_parameters = server_side_parameters or {}

def cursor(self) -> Cursor:
"""
Expand All @@ -177,7 +177,7 @@ def cursor(self) -> Cursor:
out : Cursor
The cursor.
"""
return Cursor(self.server_side_parameters)
return Cursor(server_side_parameters=self.server_side_parameters)


class SessionConnectionWrapper(object):
Expand Down

0 comments on commit ac402e7

Please sign in to comment.