fix(utils): import ProgrammingError instead of bare exc. reference#802
Open
vikrantpuppala wants to merge 1 commit into
Open
fix(utils): import ProgrammingError instead of bare exc. reference#802vikrantpuppala wants to merge 1 commit into
exc. reference#802vikrantpuppala wants to merge 1 commit into
Conversation
`ParamEscaper.escape_args` and `ParamEscaper.escape_item` both raise `exc.ProgrammingError(...)` but `exc` was never imported into utils.py. On any unsupported parameter shape the user sees `NameError: name 'exc' is not defined` instead of a clean PEP-249 `ProgrammingError`, masking the actual problem. Surfaced via the python-comparator audit harness running the `INLINE_PARAMS` connection_config: both backends raised `NameError: name 'exc' is not defined`, which the comparator's class+message match treated as parity — a false-positive that hid both the real driver bug and the underlying caller-side type mismatch. Fix: import `ProgrammingError` directly from `databricks.sql.exc` (matching the pattern used in `session.py`, `client.py`, `result_set.py`, etc.) and replace the two `exc.ProgrammingError(...)` sites with bare `ProgrammingError(...)`. Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
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
ParamEscaper.escape_argsandParamEscaper.escape_itemboth raiseexc.ProgrammingError(...)(lines 551 and 609 ofutils.py), butexcis never imported. On any unsupported parameter shape the user seesNameError: name 'exc' is not definedinstead of a clean PEP-249ProgrammingError.Surfaced via the python-comparator audit harness running the
INLINE_PARAMSconnection config: both backends raisedNameError: name 'exc' is not defined, which the comparator's class+message match treated as parity — a false-positive that hid both the real driver bug and the underlying caller-side type mismatch.Fix
Import
ProgrammingErrordirectly fromdatabricks.sql.exc(matching the pattern used insession.py,client.py,result_set.py, etc.) and replace the twoexc.ProgrammingError(...)sites with bareProgrammingError(...).Test plan
pe = ParamEscaper(); pe.escape_args(object())now raisesProgrammingError, notNameError. Same forpe.escape_item(object()).This pull request and its description were written by Isaac.