rusackas commented on code in PR #44080:
URL: https://github.com/apache/superset/pull/44080#discussion_r3992850883
##########
superset/views/datasource/views.py:
##########
@@ -121,25 +121,45 @@ def save(self) -> FlaskResponse:
except SupersetSecurityException as ex:
raise DatasetForbiddenError() from ex
- if database_id != orm_datasource.database_id:
+ # The request may repoint the dataset to a different database and/or a
+ # different table/schema/catalog; update_from_object (below) applies
+ # whatever the request supplies. Resolve the target of both dimensions
+ # up front so the access check is evaluated against what the dataset
+ # will actually point at, not its current (stale) values.
+ database_changed = database_id != orm_datasource.database_id
+ requested_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),
Review Comment:
Matches what `update_from_object` will actually apply, so an omitted key can
no longer read as "unchanged" while still landing as `None`.
```suggestion
requested_table = Table(
datasource_dict.get("table_name"),
datasource_dict.get("schema"),
datasource_dict.get("catalog"),
)
```
--
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]