dpgaspar commented on code in PR #20837:
URL: https://github.com/apache/superset/pull/20837#discussion_r961814952
##########
superset/views/base_api.py:
##########
@@ -317,13 +326,25 @@ def _get_text_for_model(self, model: Model, column_name:
str) -> str:
return getattr(model, model_column_name)
return str(model)
+ def _get_extra_field_for_model(
+ self, model: Model, column_name: str
+ ) -> Dict[str, str]:
+ ret = {}
+ if column_name in self.extra_fields_rel_fields:
+ model_column_names = self.extra_fields_rel_fields.get(column_name)
+ if model_column_names:
+ for key in model_column_names:
+ ret[key] = getattr(model, key)
+ return ret
+
def _get_result_from_rows(
self, datamodel: SQLAInterface, rows: List[Model], column_name: str
) -> List[Dict[str, Any]]:
return [
{
"value": datamodel.get_pk_value(row),
"text": self._get_text_for_model(row, column_name),
+ "extra": self._get_extra_field_for_model(row, column_name),
Review Comment:
we need to change `RelatedResultResponseSchema` to update the OpenAPI spec
--
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]