Skip to content

Commit d417a34

Browse files
committed
fixes staging_allowed_local_path on databricks, bumps databricks connector in lockfile
1 parent 9b02f03 commit d417a34

File tree

4 files changed

+29
-82
lines changed

4 files changed

+29
-82
lines changed

dlt/destinations/impl/databricks/databricks.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,15 @@ def run(self) -> None:
7272
# decide if this is a local file or a staged file
7373
is_local_file = not ReferenceFollowupJobRequest.is_reference_job(self._file_path)
7474
if is_local_file:
75-
# conn parameter staging_allowed_local_path must be set to use 'PUT/REMOVE volume_path' SQL statement
76-
self._sql_client.native_connection.thrift_backend.staging_allowed_local_path = (
77-
os.path.dirname(self._file_path)
78-
)
75+
# staging_allowed_local_path should be set when opening the connection but at that
76+
# time we do not know this path so do it now
77+
conn_ = self._sql_client.native_connection
78+
file_dir = os.path.dirname(self._file_path)
79+
if backend := getattr(conn_, "thrift_backend", None):
80+
backend.staging_allowed_local_path = file_dir
81+
else:
82+
# thrift backend discontinued on newer databricks connector clients
83+
conn_.staging_allowed_local_path = file_dir
7984
# local file by uploading to a temporary volume on Databricks
8085
from_clause, file_name, volume_path, volume_file_path = self._handle_local_file_upload(
8186
self._file_path

docs/education/dlt-fundamentals-course/lesson_3_pagination_and_authentication_and_dlt_configuration.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@
560560
"from dlt.sources.helpers.rest_client.auth import BearerTokenAuth\n",
561561
"from dlt.common.typing import TDataItems\n",
562562
"\n",
563+
"\n",
563564
"@dlt.source\n",
564565
"def github_source(\n",
565566
" access_token=dlt.secrets.value,\n",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ qdrant = [
142142
"qdrant-client[fastembed]>=1.8"
143143
]
144144
databricks = [
145-
"databricks-sql-connector>=2.9.3,<4 ; python_version <= '3.12'",
145+
"databricks-sql-connector>=2.9.3 ; python_version <= '3.12'",
146146
"databricks-sql-connector>=3.6.0 ; python_version >= '3.13'",
147147
"databricks-sdk>=0.38.0",
148148
]

uv.lock

Lines changed: 18 additions & 77 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)