Skip to content

Commit 8674bae

Browse files
authored
Add none check on _oauth_persistence in DatabricksOAuthProvider (#71)
Add none check on _oauth_persistence in DatabricksOAuthProvider to avoid app crash when _oauth_persistence is None. Signed-off-by: Jacky Hu <[email protected]>
1 parent 205f4b2 commit 8674bae

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/databricks/sql/auth/authenticators.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ def _initial_get_token(self):
8888
)
8989
self._access_token = access_token
9090
self._refresh_token = refresh_token
91-
self._oauth_persistence.persist(
92-
self._hostname, OAuthToken(access_token, refresh_token)
93-
)
91+
92+
if self._oauth_persistence:
93+
self._oauth_persistence.persist(
94+
self._hostname, OAuthToken(access_token, refresh_token)
95+
)
9496
except Exception as e:
9597
logging.error(f"unexpected error in oauth initialization", e, exc_info=True)
9698
raise e

0 commit comments

Comments
 (0)