Skip to content

Commit 70a228f

Browse files
fix(utils): import ProgrammingError instead of bare exc. reference
`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>
1 parent fb55001 commit 70a228f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/databricks/sql/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
pyarrow = None
2020

2121
from databricks.sql import OperationalError
22+
from databricks.sql.exc import ProgrammingError
2223
from databricks.sql.cloudfetch.download_manager import ResultFileDownloadManager
2324
from databricks.sql.thrift_api.TCLIService.ttypes import (
2425
TRowSet,
@@ -548,7 +549,7 @@ def escape_args(self, parameters):
548549
elif isinstance(parameters, (list, tuple)):
549550
return tuple(self.escape_item(x) for x in parameters)
550551
else:
551-
raise exc.ProgrammingError(
552+
raise ProgrammingError(
552553
"Unsupported param format: {}".format(parameters)
553554
)
554555

@@ -606,7 +607,7 @@ def escape_item(self, item):
606607
elif isinstance(item, Mapping):
607608
return self.escape_mapping(item)
608609
else:
609-
raise exc.ProgrammingError("Unsupported object {}".format(item))
610+
raise ProgrammingError("Unsupported object {}".format(item))
610611

611612

612613
def inject_parameters(operation: str, parameters: Dict[str, str]):

0 commit comments

Comments
 (0)