Skip to content

Commit

Permalink
fix: Deque mutated during iteration (#24550)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-s-molina authored Jun 29, 2023
1 parent 66f59e5 commit bb1db9e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
34 changes: 17 additions & 17 deletions superset/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,23 +850,23 @@ def ping_connection(connection: Connection, branch: bool) -> 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
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/databases/ssh_tunnel/dao_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit bb1db9e

Please sign in to comment.