bito-code-review[bot] commented on code in PR #38807:
URL: https://github.com/apache/superset/pull/38807#discussion_r3332148973


##########
superset/commands/datasource/list.py:
##########
@@ -151,6 +152,27 @@ def _serialize_rows(rows: list[Any]) -> list[dict[str, 
Any]]:
                 if sv_obj:
                     result.append(_semantic_view_schema.dump(sv_obj))
 
+        # Inject RLS summaries for dataset entries so the combined list
+        # includes the same `rls_filters` summary shape available on
+        # the standalone dataset list endpoint.
+        dataset_ids = [
+            item["id"] for item in result if item.get("source_type") == 
"database"
+        ]
+        if dataset_ids:
+            try:
+                rls_map = DatasetDAO.get_rls_filters_for_datasets(dataset_ids)
+                for item in result:
+                    if item.get("source_type") == "database":
+                        item_id = item.get("id")
+                        if isinstance(item_id, int):
+                            item["rls_filters"] = rls_map.get(item_id, [])
+                        else:
+                            item["rls_filters"] = []
+            except Exception:  # pragma: no cover - defensive
+                logger.exception(
+                    "Failed to inject RLS summaries into combined datasource 
list"
+                )

Review Comment:
   <!-- Bito Reply -->
   The user is asking whether Bito should avoid making suggestions like the one 
in the provided code review for future reviews. The suggestion in question is 
about catching a specific exception (`SQLAlchemyError`) instead of a broad 
`Exception` to improve error handling. This is a valid and helpful suggestion 
that promotes better coding practices by making error handling more precise and 
defensive. It is recommended to keep such suggestions in future reviews as they 
contribute to code quality and maintainability.



-- 
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]

Reply via email to