Upgrade outdated Python dependencies
109 of our direct Python dependencies are behind their latest release. Some upgrade with no code changes, some need code changes, and a few are blocked by other packages. This issue tracks the plan. Each step is its own PR, and the PRs are stacked in the order below, each based on the one before it.
Related PRs outside this stack:
- #7819 (merged): sqlparse 0.6 (three DoS CVEs)
- #7808 (merged): vertica-python 1.4 (restores the Vertica runner on Python 3.13)
- #7806: snowflake-connector-python 4.7.3 plus runner tests (step 3 moves it to 4.7.5)
- #7746: replaces advocate with
champion. It turns SSRF protection off by default and depends on an unreleased personal fork, so step 7 takes a different route.
PRs
- 1. #7831
- 2. #7832
- 3. #7833
- 4. #7834
- 5. #7838
- 6. #7839
- 7. #7840
- 8. #7841
- 9. #7842
- 10. #7843
- 11. #7844
- 12. #7846
- 13. #7847
Blockers
| Blocker | What it holds back | Resolution |
|---|---|---|
advocate 1.0.0 (unmaintained since 2020) requires urllib3<2 |
urllib3 2.x, td-client 1.7, newer pinotdb | Replace it with our own small SSRF-safe transport adapter (step 7) |
nzalchemy 11.0.2 requires SQLAlchemy<=1.3.24 |
every SQLAlchemy upgrade | Remove it; Redash never uses its dialect (step 2) |
sqlalchemy-utils (every release) doesn't import on SQLAlchemy 2.1 |
SQLAlchemy 2.1 | Target 2.0 for now |
flask-sqlalchemy 2.5.1 imports Flask internals removed in Flask 3 |
Flask 3 / Werkzeug 3 | flask-sqlalchemy 3 first, which needs SQLAlchemy 1.4 or later |
pydgraph (every release) requires protobuf<7 |
protobuf 7 | Stay on protobuf 6 |
sshtunnel (every release) uses paramiko.DSSKey, removed in paramiko 4 |
paramiko 4/5 | Stay on paramiko 3.5.x. The resolver can't catch this. |
rq-scheduler 0.14 requires rq>=2 |
rq-scheduler | Upgrade it together with rq (step 8) |
Steps
Snapshot version format. Snapshot builds are versioned
26.09.0-dev, and a leading zero isn't valid semver, so the version check raises for Jan–Sep snapshots. Generate26.9.0-devinstead, and moveversion_checkto the semver 3 API.Unused dependencies. Remove
oauth2client(unused since #6422), the directhttplib2pin (it only existed for an unused import incouchbase.py; google-api-python-client still installs it), andnzalchemy(it only registers a SQLAlchemy dialect Redash never uses, and its SQLAlchemy cap blocked every upgrade).Upgrades that need no code changes. Core, infra, query-runner and dev packages that upgrade cleanly. Notable items:
- cryptography 50 + pyopenssl 26.4 + jwcrypto 1.6 (must move together)
- restrictedpython 8.5 (fixes Python query runner sandbox escapes)
- vertica-python 1.4 (1.1.1 imports
crypt, which Python 3.13 removed, so the Vertica runner is currently silently disabled) - paramiko held at 3.5.x
- pytest 9 (plus a one-line test fix)
flask-wtf 1.3 + WTForms 3. The CSRF blueprint-exemption workaround in
redash/security.pysilently stops working from flask-wtf 1.1.2. Replace it withcsrf.protect(apply_exemptions=True). Also fix thewtforms.fields.html5import and addemail-validator.Query runner libraries:
- gspread 6:
login()moved tohttp_client - simple-salesforce 1.x:
sandbox→domain;query_allno longer returns the server'stotalSize, which breaksSELECT COUNT() - python-arango 8: new 60s default request timeout
- duckdb 1.5:
cursor.descriptiontype is no longer a string - pymongo 4.18: the
srv/tlsextras were removed; the minimum MongoDB server is now 4.4
- gspread 6:
pandas 3:
- datetime columns are no longer always nanosecond resolution
- text columns get a new string dtype, so CSV/Excel runners currently drop them
read_excelno longer accepts raw bytes
Also pyexasol 2, which now verifies TLS certificates by default; add an option to disable verification for self-signed servers.
Replace advocate with our own SSRF-safe adapter that works on urllib3 1.26 and 2.x, then upgrade urllib3 2, td-client 1.7 and pinotdb.
rq 2 + rq-scheduler 0.14 + redis-py. rq 2 removed
Connection/push_connection, so connections must be passed explicitly; the worker internals changed too. This step uses redis-py 7.x. redis-py 8 defaults to RESP3, which can't talk to Redis servers older than 6, so moving to 8 needs a decision on the minimum Redis version.SQLAlchemy 1.4 with sqlalchemy-searchable 2.2 and sqlalchemy-utils 0.42:
- rewrite
redash/utils/query_order.py, which relies on SQLAlchemy internals that were removed ChangeTrackingMixinguardload_onlysubqueries- migration for sqlalchemy-searchable's new search SQL functions
- rewrite
flask-sqlalchemy 3.0. The pool-config overrides in
redash/models/base.pyare no longer called; move them toengine_options.BaseQueryis renamed,paginate()takes keyword arguments only, and the test setup needs updating for app-scoped sessions.Flask 3.1 + Werkzeug 3.1.
SQLAlchemy 2.0 with flask-sqlalchemy 3.1:
text()for raw SQL, attribute-basedload_only, and fixes to 4 old alembic migrations.ruff 0.16. Config layout change; the code already passes, so there is no lint diff. CI and pre-commit pins move with it.
Unmaintained, with no replacement planned here
flask-restful, passlib, memsql, pyignite, pypd, and maxminddb-geolite2 (bundles 2018 data).
Source: getredash/redash