diff --git a/.changes/unreleased/Fixes-20230509-143721.yaml b/.changes/unreleased/Fixes-20230509-143721.yaml new file mode 100644 index 000000000..6d80abf7c --- /dev/null +++ b/.changes/unreleased/Fixes-20230509-143721.yaml @@ -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: ''' ''' diff --git a/dbt/adapters/redshift/connections.py b/dbt/adapters/redshift/connections.py index 59058f53b..c1e55d2fa 100644 --- a/dbt/adapters/redshift/connections.py +++ b/dbt/adapters/redshift/connections.py @@ -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 diff --git a/tests/unit/test_redshift_adapter.py b/tests/unit/test_redshift_adapter.py index 25f3b3d73..c90a53dfd 100644 --- a/tests/unit/test_redshift_adapter.py +++ b/tests/unit/test_redshift_adapter.py @@ -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):