Skip to content

Commit 955743a

Browse files
feat: Add query-id to SQLQueryStatus (#1280)
<!-- Please review our pull request review process in CONTRIBUTING.md before your proceed. --> Resolves # <!--- Include the number of the issue addressed by this PR above if applicable. Example: resolves #1234 Please review our pull request review process in CONTRIBUTING.md before your proceed. --> ### Description It's useful to get the query_id for debugging and tracking, any issue with adding the query_id here? <!--- Describe the Pull Request here --> ### Checklist - [ ] I have run this code in development and it appears to resolve the stated issue - [ ] This PR includes tests, or tests are not required/relevant for this PR - [ ] I have updated the `CHANGELOG.md` and added information about my change to the "dbt-databricks next" section.
1 parent cd5d71f commit 955743a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## dbt-databricks 1.11.4 (TBD)
22

3+
### Features
4+
- Add `query_id` to `SQLQueryStatus` events to improve query tracing and debugging
5+
36
## dbt-databricks 1.11.3 (Dec 5, 2025)
47

58
### Fixes

dbt/adapters/databricks/connections.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,13 @@ def add_query(
339339

340340
handle: DatabricksHandle = connection.handle
341341
cursor = handle.execute(sql, bindings)
342-
342+
response = self.get_response(cursor)
343343
fire_event(
344344
SQLQueryStatus(
345345
status=str(cursor.get_response()),
346346
elapsed=round((time.time() - pre), 2),
347347
node_info=get_node_info(),
348+
query_id=response.query_id,
348349
)
349350
)
350351

@@ -401,9 +402,11 @@ def _execute_with_cursor(
401402
handle: DatabricksHandle = connection.handle
402403
cursor = f(handle)
403404

405+
response = self.get_response(cursor)
404406
fire_event(
405407
SQLQueryStatus(
406-
status=str(self.get_response(cursor)),
408+
status=str(response),
409+
query_id=response.query_id,
407410
elapsed=round((time.time() - pre), 2),
408411
node_info=get_node_info(),
409412
)

0 commit comments

Comments
 (0)