You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by el...@apache.org on 2026/07/02 22:01:29 UTC
(superset) branch master updated: fix(redshift): suppress unavoidable pkg_resources deprecation warning (#41691)
This is an automated email from the ASF dual-hosted git repository.
eschutho 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 22c3f56d0a7 fix(redshift): suppress unavoidable pkg_resources deprecation warning (#41691)
22c3f56d0a7 is described below
commit 22c3f56d0a753f3e22c1c37edfac965f5bd371e3
Author: Elizabeth Thompson <es...@gmail.com>
AuthorDate: Thu Jul 2 15:01:23 2026 -0700
fix(redshift): suppress unavoidable pkg_resources deprecation warning (#41691)
---
superset/db_engine_specs/redshift.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/superset/db_engine_specs/redshift.py b/superset/db_engine_specs/redshift.py
index b6d0688fda2..de6a2a5b514 100644
--- a/superset/db_engine_specs/redshift.py
+++ b/superset/db_engine_specs/redshift.py
@@ -18,6 +18,7 @@ from __future__ import annotations
import logging
import re
+import warnings
from re import Pattern
from typing import Any
@@ -33,6 +34,23 @@ from superset.models.sql_lab import Query
from superset.sql.parse import Table
from superset.utils import json
+# sqlalchemy-redshift's own __init__ still imports pkg_resources (#36082);
+# the pinned range (see pyproject.toml) can't move to the pkg_resources-free
+# 1.0.0 release without SQLAlchemy 2.0 (apache/superset#39750 was closed for
+# this reason). Database._get_sqla_engine() (superset/models/core.py) always
+# reads self.db_engine_spec -- which imports every db_engine_specs module,
+# including this one, via load_engine_specs() -- before it calls
+# create_engine(), which is what triggers SQLAlchemy's lazy "redshift://"
+# dialect entry-point loading that actually imports sqlalchemy_redshift. So
+# by the time that import happens, this filter is already registered.
+# Setuptools 80.x (pinned in requirements/base.txt) raises this as a plain
+# UserWarning, not DeprecationWarning -- don't add category=DeprecationWarning
+# here, it would silently stop matching.
+warnings.filterwarnings(
+ "ignore",
+ message=r"pkg_resources is deprecated as an API",
+)
+
logger = logging.getLogger()
# Regular expressions to catch custom errors