You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by kg...@apache.org on 2026/05/29 16:26:18 UTC
(superset) 11/23: docs(activity-view): document per-kind query rationale in _select_change_rows_for_kinds
This is an automated email from the ASF dual-hosted git repository.
kgabryje pushed a commit to branch sc-107283-versioning-activity-view
in repository https://gitbox.apache.org/repos/asf/superset.git
commit b96cb0167085f0f5833eb1ba00412b9fcfcde862
Author: Mike Bridge <mi...@ext.preset.io>
AuthorDate: Tue May 26 16:07:55 2026 -0600
docs(activity-view): document per-kind query rationale in _select_change_rows_for_kinds
No-op docstring change. The function fires one SELECT per entity_kind
with entity_id IN (...) instead of one query with tuple_(entity_kind,
entity_id).in_(...). The latter is supported by Postgres but its SQL
emission across MySQL and SQLite is uneven (some dialects emit literal
ROW expressions, some emit a transformed multi-column form, some don't
support it at all in older versions). Three round-trips per request is
the correct trade-off given Superset's multi-dialect requirement.
Documenting now so a future reader doesn't reach for the tuple-IN
"optimisation" and silently break MySQL or SQLite. Surfaced by the
SQLAlchemy review.
Co-Authored-By: Claude Opus 4.7 (1M context) <no...@anthropic.com>
---
superset/versioning/activity.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/superset/versioning/activity.py b/superset/versioning/activity.py
index 73b319924d7..bcf083cbf15 100644
--- a/superset/versioning/activity.py
+++ b/superset/versioning/activity.py
@@ -317,7 +317,16 @@ def _select_change_rows_for_kinds(
"""Fire one SELECT per entity_kind with ``entity_id IN (...)``;
concatenate the results. Each SELECT joins ``version_transaction``
+ ``ab_user`` so the orchestrator has the columns it needs for
- decoration."""
+ decoration.
+
+ Per-kind, not one query: SQLAlchemy's ``tuple_(entity_kind,
+ entity_id).in_(...)`` would collapse the three queries into one,
+ but its SQL emission is not portable across Postgres, MySQL, and
+ SQLite. The per-kind shape is the correct trade-off given
+ Superset's multi-dialect requirement (at most 3 round-trips per
+ request, bounded by the kind taxonomy). Do not "optimise" into a
+ composite-tuple IN clause without verifying the SQL on all three
+ dialects."""
# pylint: disable=import-outside-toplevel
from sqlalchemy_continuum import versioning_manager