sha174n commented on code in PR #44080:
URL: https://github.com/apache/superset/pull/44080#discussion_r4133862028
##########
superset/views/datasource/views.py:
##########
@@ -121,25 +256,28 @@ def save(self) -> FlaskResponse:
except SupersetSecurityException as ex:
raise DatasetForbiddenError() from ex
- if database_id != orm_datasource.database_id:
- new_database = DatasetDAO.get_database_by_id(database_id)
- if new_database is None:
- return json_error_response(_("Database not found."),
status=422)
- try:
- security_manager.raise_for_access(
- database=new_database,
- # Check access against the table/schema/catalog the
- # request is repointing to, not the dataset's current
- # values -- update_from_object (below) applies whatever
- # table_name/schema/catalog the request supplies.
- table=Table(
- datasource_dict.get("table_name",
orm_datasource.table_name),
- datasource_dict.get("schema", orm_datasource.schema),
- datasource_dict.get("catalog", orm_datasource.catalog),
- ),
- )
- except SupersetSecurityException as ex:
- raise DatasetForbiddenError() from ex
+ database_changed = database_id != orm_datasource.database_id
+ try:
+ requested_sql, requested_table = _requested_target(datasource_dict)
+ except ValueError as ex:
+ return json_error_response(
+ _(
+ "Dataset schema is invalid, caused by: %(error)s",
+ error=f"`{ex}` must be a string",
Review Comment:
Fixed in 0fc4493. The whole sentence is one msgid now (`The `%(field)s`
field must be a string.`), so nothing is interpolated after `_()`, and it no
longer claims the dataset schema is at fault when the failure is a request body
field type. Extraction template regenerated so the new string is translatable;
a test asserts the response names the offending field.
--
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]