Fix: REMOVE staging operation no longer requires staging_allowed_local_path (#726)#846
Merged
Merged
Conversation
…726) A REMOVE staging operation deletes a remote resource and never touches the local filesystem, yet _handle_staging_operation raised a ProgrammingError demanding staging_allowed_local_path before dispatching to any handler. This forced callers to pass a dummy path (e.g. "/") just to run a REMOVE, even though the value is never used. Handle REMOVE before the staging_allowed_local_path validation block, mirroring how the __input_stream__ PUT path already bypasses it. GET and local-file PUT continue to require staging_allowed_local_path. Closes #726 Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
gopalldb
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #726.
A
REMOVEstaging operation deletes a remote resource and never touches the local filesystem, yetCursor._handle_staging_operationraised:before dispatching to any handler when
staging_allowed_local_pathwasNone. This forced callers to pass a dummy path (e.g."/") just to run aREMOVE, even though the value is never used for that operation — the reporter observed they couldPUTvia__input_stream__without a path, butREMOVEstill demanded one.Root cause
In
src/databricks/sql/client.py,_handle_staging_operationvalidatedstaging_allowed_local_pathfor every non-streaming operation before dispatch. TheREMOVEbranch then explicitly poppedlocal_filebecause "Local file isn't needed to remove a remote resource" — confirming the requirement was spurious forREMOVE.Fix
Handle
REMOVEearly, right after the existing__input_stream__PUT bypass and before thestaging_allowed_local_pathvalidation block.GETand local-filePUTcontinue to requirestaging_allowed_local_path.Test plan
Added
tests/unit/test_staging_remove.py:test_remove_without_staging_allowed_local_path— the repro:REMOVEwithstaging_allowed_local_path=Nonenow dispatches to_handle_staging_remove(nolocal_fileforwarded) instead of raising. Fails before the fix, passes after.test_remove_with_staging_allowed_local_path—REMOVEstill works when a path is provided.test_get_still_requires_staging_allowed_local_path— regression guard:GETwithNonestill raises the original error.test_unsupported_operation_still_errors— unknown operations still raise.Verification:
poetry run python -m pytest tests/unit/test_staging_remove.py tests/unit/test_streaming_put.py— 8 passedpoetry run python -m pytest tests/unit/test_client.py— 128 passed, 2 skipped-m "not realkernel") — 869 passed, 4 skippedpoetry run black— no changes neededAdded a CHANGELOG entry under a new Unreleased section.
Closes #726