community[patch]: Fix sql_databse.from_databricks issue when ran from Job (#23224)

**Desscription**: When the ``sql_database.from_databricks`` is executed
from a Workflow Job, the ``context`` object does not have a
"browserHostName" property, resulting in an error. This change manages
the error so the "DATABRICKS_HOST" env variable value is used instead of
stoping the flow

Co-authored-by: lmorosdb <lmorosdb>
pull/23671/head
Luis Moros 2 months ago committed by GitHub
parent cd6812342e
commit d5be160af0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -201,10 +201,10 @@ class SQLDatabase:
from dbruntime.databricks_repl_context import get_context
context = get_context()
default_host = context.browserHostName
except ImportError:
pass
default_host = None
default_host = context.browserHostName if context else None
if host is None:
host = get_from_env("host", "DATABRICKS_HOST", default_host)

Loading…
Cancel
Save