Skip to content

Commit

Permalink
ISSUE-19651: handle starburst JWToken expiration (#19689)
Browse files Browse the repository at this point in the history
* fix: handle starburst JWToken expiration

* style: ran python linting
  • Loading branch information
TeddyCr authored Feb 7, 2025
1 parent 90b8202 commit e90bf9d
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ def get_connection(connection: TrinoConnection) -> Engine:
# here we are creating a copy of connection, because we need to dynamically
# add auth params to connectionArguments, which we do no intend to store
# in original connection object and in OpenMetadata database
from trino.sqlalchemy.dialect import TrinoDialect

TrinoDialect.is_disconnect = _is_disconnect

connection_copy = deepcopy(connection)
if connection_copy.verify:
connection_copy.connectionArguments = (
Expand Down Expand Up @@ -183,3 +187,11 @@ def test_connection(
queries=queries,
timeout_seconds=timeout_seconds,
)


# pylint: disable=unused-argument
def _is_disconnect(self, e, connection, cursor):
"""is_disconnect method for the Databricks dialect"""
if "JWT expired" in str(e):
return True
return False

0 comments on commit e90bf9d

Please sign in to comment.