You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/09/16 23:53:50 UTC
(superset) branch master updated: fix(db): honor connect_args returned by adjust_engine_params (#44078)
This is an automated email from the ASF dual-hosted git repository.
rusackas 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 3d17fba3624 fix(db): honor connect_args returned by adjust_engine_params (#44078)
3d17fba3624 is described below
commit 3d17fba3624affdb0013e96bfc3e9401649cf775
Author: Shaitan <10...@users.noreply.github.com>
AuthorDate: Thu Sep 17 00:53:43 2026 +0100
fix(db): honor connect_args returned by adjust_engine_params (#44078)
Co-authored-by: Claude Opus 4.8 <no...@anthropic.com>
---
superset/models/core.py | 1 +
tests/unit_tests/models/core_test.py | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/superset/models/core.py b/superset/models/core.py
index 205187d2cb2..e6953db1c45 100755
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -659,6 +659,7 @@ class Database(CoreDatabase, AuditMixinNullable, ImportExportMixin): # pylint:
catalog=catalog,
schema=schema,
)
+ engine_kwargs["connect_args"] = connect_args
effective_username = self.get_effective_user(sqlalchemy_url)
if effective_username and is_feature_enabled("IMPERSONATE_WITH_EMAIL_PREFIX"):
diff --git a/tests/unit_tests/models/core_test.py b/tests/unit_tests/models/core_test.py
index 3a167a74a02..c614e44f401 100644
--- a/tests/unit_tests/models/core_test.py
+++ b/tests/unit_tests/models/core_test.py
@@ -595,6 +595,29 @@ def test_get_sqla_engine(mocker: MockerFixture) -> None:
)
+def test_get_sqla_engine_honors_adjusted_connect_args(mocker: MockerFixture) -> None:
+ """
+ ``adjust_engine_params`` returns a *new* ``connect_args`` dict (the base
+ impl merges ``enforce_uri_query_params`` into a fresh copy). The result must
+ be written back into ``engine_kwargs`` so those enforced params actually
+ reach ``create_engine``. Exercised via MySQL, which enforces
+ ``local_infile=0`` this way; before the write-back the enforcement was
+ silently dropped.
+ """
+ from superset.models.core import Database
+
+ create_engine_mock = mocker.patch(
+ "superset.models.core.create_engine",
+ return_value=create_engine("sqlite://"),
+ )
+
+ database = Database(database_name="my_db", sqlalchemy_uri="mysql://u:p@h/db")
+ database._get_sqla_engine(nullpool=False)
+
+ _, kwargs = create_engine_mock.call_args
+ assert kwargs["connect_args"].get("local_infile") == 0
+
+
def test_get_sqla_engine_caches_engine_per_url(mocker: MockerFixture) -> None:
"""
Regression for #27897: a single SQLAlchemy ``Engine`` should be created per