bito-code-review[bot] commented on code in PR #44633:
URL: https://github.com/apache/superset/pull/44633#discussion_r4101736395
##########
superset/connectors/sqla/models.py:
##########
@@ -1903,6 +1903,14 @@ def time_grain_sqla(self) -> list[tuple[Any, Any]]:
@property
def data(self) -> ExplorableData:
data_ = super().data
+ # Editors gate the "Edit dataset" action in Explore. They are
serialized
+ # with the same compact subject shape the dataset REST API exposes
+ # (``editors.id`` / ``editors.label`` / ``editors.type``) so both
+ # payloads can be consumed by the same frontend code.
+ data_["editors"] = [
+ {"id": editor.id, "label": editor.label, "type": editor.type}
+ for editor in self.editors
+ ]
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Lazy-load editors on hot path</b></div>
<div id="fix">
`self.editors` (models.py:1641) has no eager loading, so each
`SqlaTable.data` call now issues a lazy-load query through the M2M junction.
`.data` runs on hot paths that only read `verbose_map`/`column_formats` —
`query_context_processor.get_data` (line 570), `charts/client_processing.py`
(879/898/930), `datasource_info` (datasource/api.py:882), `data_for_slices`.
Consider eager-loading `editors` or computing it only where the payload needs
it.
</div>
</div>
<small><i>Code Review Run #37fbdc</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]