Skip to content

Commit

Permalink
Add update_type and rowcount to dbt commands SQL status in CLI output
Browse files Browse the repository at this point in the history
  • Loading branch information
damian3031 committed Aug 12, 2024
1 parent a8f4a98 commit 5115e94
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .changes/unreleased/Features-20240812-161625.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Features
body: Added update_type and rowcount to dbt commands SQL status in CLI output
time: 2024-08-12T16:16:25.330055+02:00
custom:
Author: damian3031
Issue: "428"
PR: "429"
12 changes: 10 additions & 2 deletions dbt/adapters/trino/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,20 @@ def open(cls, connection):

@classmethod
def get_response(cls, cursor) -> TrinoAdapterResponse:
message = "SUCCESS"
code = cursor._cursor.update_type
if code is None:
code = "SUCCESS"

rows_affected = cursor._cursor.rowcount
if rows_affected == -1:
message = f"{code}"
else:
message = f"{code} ({rows_affected:_} rows)"
return TrinoAdapterResponse(
_message=message,
query=cursor._cursor.query,
query_id=cursor._cursor.query_id,
rows_affected=cursor._cursor.rowcount,
rows_affected=rows_affected,
) # type: ignore

def cancel(self, connection):
Expand Down

0 comments on commit 5115e94

Please sign in to comment.