Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20230509-143721.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: Update signature for execute method
time: 2023-05-09T14:37:21.163869-07:00
custom:
Author: nssalian
Issue: ''' '''
8 changes: 6 additions & 2 deletions dbt/adapters/redshift/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,16 @@ def exponential_backoff(attempt: int):
)

def execute(
self, sql: str, auto_begin: bool = False, fetch: bool = False
self,
sql: str,
auto_begin: bool = False,
fetch: bool = False,
limit: Optional[int] = None,
) -> Tuple[AdapterResponse, agate.Table]:
_, cursor = self.add_query(sql, auto_begin)
response = self.get_response(cursor)
if fetch:
table = self.get_result_from_cursor(cursor)
table = self.get_result_from_cursor(cursor, limit)
else:
table = dbt.clients.agate_helper.empty_table()
return response, table
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_redshift_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def test_execute_with_fetch(self):
mock_get_result_from_cursor.return_value = table
self.adapter.connections.execute(sql="select * from test", fetch=True)
mock_add_query.assert_called_once_with("select * from test", False)
mock_get_result_from_cursor.assert_called_once_with(cursor)
mock_get_result_from_cursor.assert_called_once_with(cursor, None)
mock_get_response.assert_called_once_with(cursor)

def test_execute_without_fetch(self):
Expand Down