nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: dbt-labs/dbt-redshift
Pull request #435 (2023-05-09 21:46:17)

Fix execute signature based on core
fixes the signature change in `execute` from `dbt-core` here: https://github.com/dbt-labs/dbt-core/pull/7545

### Description



### Checklist

- [x] I have read [the contributing guide](https://github.com/dbt-labs/dbt-redshift/blob/main/CONTRIBUTING.md) and understand what's expected of me
- [x] I have signed the [CLA](https://docs.getdbt.com/docs/contributor-license-agreements)
- [x] I have run this code in development and it appears to resolve the stated issue
- [x] This PR includes tests, or tests are not required/relevant for this PR
- [ ] I have [opened an issue to add/update docs](https://github.com/dbt-labs/docs.getdbt.com/issues/new/choose), or docs changes are not required/relevant for this PR
- [ ] I have run `changie new` to [create a changelog entry](https://github.com/dbt-labs/dbt-redshift/blob/main/CONTRIBUTING.md#Adding-CHANGELOG-Entry)



Patch:
diff --git a/.changes/unreleased/Fixes-20230509-143721.yaml b/.changes/unreleased/Fixes-20230509-143721.yaml
new file mode 100644
index 00000000..6d80abf7
--- /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 59058f53..c1e55d2f 100644
--- a/dbt/adapters/redshift/connections.py
+++ b/dbt/adapters/redshift/connections.py
@@ -299,12 +299,16 @@ class RedshiftConnectionManager(SQLConnectionManager):
         )
 
     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


Test patch:
diff --git a/tests/unit/test_redshift_adapter.py b/tests/unit/test_redshift_adapter.py
index 25f3b3d7..c90a53df 100644
--- a/tests/unit/test_redshift_adapter.py
+++ b/tests/unit/test_redshift_adapter.py
@@ -408,7 +408,7 @@ class TestRedshiftAdapter(unittest.TestCase):
                     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):
Repository: dbt-labs/dbt-snowflake
Pull request #738 (2023-08-11 21:25:48)

[Backport 1.6.latest] Update connections.py so it doesn’t run anything after its canceled
backport of #716 


Patch:
diff --git a/.changes/unreleased/Fixes-20230804-175222.yaml b/.changes/unreleased/Fixes-20230804-175222.yaml
new file mode 100644
index 0000000..b222b21
--- /dev/null
+++ b/.changes/unreleased/Fixes-20230804-175222.yaml
@@ -0,0 +1,6 @@
+kind: Fixes
+body: Cancel all queries when terminating dbt
+time: 2023-08-04T17:52:22.956964-06:00
+custom:
+  Author: julio-romero
+  Issue: "711"
diff --git a/dbt/adapters/snowflake/connections.py b/dbt/adapters/snowflake/connections.py
index 9e7b492..6f9a9b6 100644
--- a/dbt/adapters/snowflake/connections.py
+++ b/dbt/adapters/snowflake/connections.py
@@ -375,7 +375,7 @@ class SnowflakeConnectionManager(SQLConnectionManager):
 
         connection_name = connection.name
 
-        sql = "select system$abort_session({})".format(sid)
+        sql = "select system$cancel_all_queries({})".format(sid)
 
         logger.debug("Cancelling query '{}' ({})".format(connection_name, sid))
 


Test patch:
diff --git a/tests/unit/test_snowflake_adapter.py b/tests/unit/test_snowflake_adapter.py
index dd1fb8b..85bbb38 100644
--- a/tests/unit/test_snowflake_adapter.py
+++ b/tests/unit/test_snowflake_adapter.py
@@ -265,7 +265,7 @@ class TestSnowflakeAdapter(unittest.TestCase):
 
             self.assertEqual(len(list(self.adapter.cancel_open_connections())), 1)
 
-            add_query.assert_called_once_with("select system$abort_session(42)")
+            add_query.assert_called_once_with("select system$cancel_all_queries(42)")
 
     def test_client_session_keep_alive_false_by_default(self):
         conn = self.adapter.connections.set_connection_name(name="new_connection_with_new_config")