You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2023/06/29 15:12:25 UTC

[superset] branch master updated: fix: Deque mutated during iteration (#24550)

This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new bb1db9e86f fix: Deque mutated during iteration (#24550)
bb1db9e86f is described below

commit bb1db9e86f4445603fc0dff7964faff87d27b2b0
Author: Michael S. Molina <70...@users.noreply.github.com>
AuthorDate: Thu Jun 29 12:12:12 2023 -0300

    fix: Deque mutated during iteration (#24550)
---
 superset/utils/core.py                             | 34 +++++++++++-----------
 tests/unit_tests/databases/ssh_tunnel/dao_tests.py |  2 +-
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/superset/utils/core.py b/superset/utils/core.py
index 226daad45e..ca3b9ae7b7 100644
--- a/superset/utils/core.py
+++ b/superset/utils/core.py
@@ -850,23 +850,23 @@ def pessimistic_connection_handling(some_engine: Engine) -> None:
             # restore 'close with result'
             connection.should_close_with_result = save_should_close_with_result
 
-        if some_engine.dialect.name == "sqlite":
-
-            @event.listens_for(some_engine, "connect")
-            def set_sqlite_pragma(  # pylint: disable=unused-argument
-                connection: sqlite3.Connection,
-                *args: Any,
-            ) -> None:
-                r"""
-                Enable foreign key support for SQLite.
-
-                :param connection: The SQLite connection
-                :param \*args: Additional positional arguments
-                :see: https://docs.sqlalchemy.org/en/latest/dialects/sqlite.html
-                """
-
-                with closing(connection.cursor()) as cursor:
-                    cursor.execute("PRAGMA foreign_keys=ON")
+    if some_engine.dialect.name == "sqlite":
+
+        @event.listens_for(some_engine, "connect")
+        def set_sqlite_pragma(  # pylint: disable=unused-argument
+            connection: sqlite3.Connection,
+            *args: Any,
+        ) -> None:
+            r"""
+            Enable foreign key support for SQLite.
+
+            :param connection: The SQLite connection
+            :param \*args: Additional positional arguments
+            :see: https://docs.sqlalchemy.org/en/latest/dialects/sqlite.html
+            """
+
+            with closing(connection.cursor()) as cursor:
+                cursor.execute("PRAGMA foreign_keys=ON")
 
 
 def send_email_smtp(  # pylint: disable=invalid-name,too-many-arguments,too-many-locals
diff --git a/tests/unit_tests/databases/ssh_tunnel/dao_tests.py b/tests/unit_tests/databases/ssh_tunnel/dao_tests.py
index af0b1ac001..4dfbc5fcd7 100644
--- a/tests/unit_tests/databases/ssh_tunnel/dao_tests.py
+++ b/tests/unit_tests/databases/ssh_tunnel/dao_tests.py
@@ -35,7 +35,7 @@ def test_create_ssh_tunnel():
         "password": "bar",
     }
 
-    result = SSHTunnelDAO.create(properties)
+    result = SSHTunnelDAO.create(properties, commit=False)
 
     assert result is not None
     assert isinstance(result, SSHTunnel)