community: Fix SQLDatabse.from_databricks issue when ran from Job (#24346)

- Description: When SQLDatabase.from_databricks is ran from a Databricks
Workflow job, line 205 (default_host = context.browserHostName) throws
an ``AttributeError`` as the ``context`` object has no
``browserHostName`` attribute. The fix handles the exception and sets
the ``default_host`` variable to null

---------

Co-authored-by: lmorosdb <lmorosdb>
Co-authored-by: Eugene Yurtsev <eugene@langchain.dev>
This commit is contained in:
Luis Moros
2024-07-17 12:40:12 -04:00
committed by GitHub
parent 24e9b48d15
commit bcb5f354ad

View File

@@ -203,7 +203,7 @@ class SQLDatabase:
context = get_context()
default_host = context.browserHostName
except ImportError:
except (ImportError, AttributeError):
default_host = None
if host is None: