Skip to content

Commit

Permalink
Merge branch 'main' into microbatch-behavior-flag
Browse files Browse the repository at this point in the history
  • Loading branch information
QMalcolm committed Nov 6, 2024
2 parents 087ffd1 + da2a380 commit 261e9ac
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 103 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20241105-121440.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Under the Hood
body: Add `query_id` to SQLQueryStatus
time: 2024-11-05T12:14:40.181931-05:00
custom:
Author: cmcarthur
Issue: "342"
1 change: 1 addition & 0 deletions dbt/adapters/contracts/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class AdapterResponse(dbtClassMixin):
_message: str
code: Optional[str] = None
rows_affected: Optional[int] = None
query_id: Optional[str] = None

def __str__(self):
return self._message
Expand Down
1 change: 1 addition & 0 deletions dbt/adapters/events/adapter_types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ message SQLQueryStatus {
AdapterNodeInfo node_info = 1;
string status = 2;
float elapsed = 3;
string query_id = 4;
}

message SQLQueryStatusMsg {
Expand Down
205 changes: 103 additions & 102 deletions dbt/adapters/events/adapter_types_pb2.py

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion dbt/adapters/sql/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,14 @@ def add_query(
cursor = connection.handle.cursor()
cursor.execute(sql, bindings)

result = self.get_response(cursor)

fire_event(
SQLQueryStatus(
status=str(self.get_response(cursor)),
status=str(result),
elapsed=time.perf_counter() - pre,
node_info=get_node_info(),
query_id=result.query_id,
)
)

Expand Down

0 comments on commit 261e9ac

Please sign in to comment.