Open LaurenceLong opened 1 month ago
@LaurenceLong Hello there! 👋 I'm here to help you with any bugs, questions, or contributions you have for the project. I'm looking forward to working with you!
To resolve the "Failed to load dimensions for drill by" error when using the Gamma role in Apache Superset, ensure the following:
Dataset Existence: Verify that the dataset with the specified datasetId
exists in the database. You can check this by querying the database directly or using an API endpoint that lists available datasets.
Permissions: Ensure that the Gamma role has the necessary permissions to access the dataset and the columns required for the drill-by functionality. This includes:
Correct Endpoint: Double-check the endpoint URL and ensure that the datasetId
is correctly formatted and valid.
Database Access: Verify that the database is accessible and that there are no connection issues. Ensure that the database is properly configured and running.
Here is a relevant code snippet that handles the loading of drill-by options and the error handling:
useEffect(() => {
async function loadOptions() {
const datasetId = Number(formData.datasource.split('__')[0]);
try {
setIsLoadingColumns(true);
let response: JsonResponse;
if (loadDrillByOptions) {
response = await loadDrillByOptions(datasetId, formData);
} else {
response = await cachedSupersetGet({
endpoint: `/api/v1/dataset/${datasetId}?q=${queryString}`,
});
}
const { json } = response;
const { result } = json;
setDataset(result);
setColumns(
ensureIsArray(result.columns)
.filter(column => column.groupby)
.filter(
column =>
!ensureIsArray(
formData[drillByConfig?.groupbyFieldName ?? ''],
).includes(column.column_name) &&
column.column_name !== formData.x_axis &&
ensureIsArray(excludedColumns)?.every(
excludedCol => excludedCol.column_name !== column.column_name,
),
),
);
} catch (error) {
logging.error(error);
supersetGetCache.delete(`/api/v1/dataset/${datasetId}`);
addDangerToast(t('Failed to load dimensions for drill by'));
} finally {
setIsLoadingColumns(false);
}
}
if (handlesDimensionContextMenu && hasDrillBy) {
loadOptions();
}
}, [
addDangerToast,
drillByConfig?.groupbyFieldName,
excludedColumns,
formData,
handlesDimensionContextMenu,
hasDrillBy,
]);
By ensuring the dataset exists, the Gamma role has the necessary permissions, the endpoint is correct, and the database is accessible, you can mitigate the occurrence of the 404 error and the "Failed to load dimensions for drill by" alert [1][2].
To continue talking to Dosu, mention @dosu.
I just add all_datasource_access to Gamma role and it works. But I think get columns from datasource/samples api may be a better way.
I can validate: I added can_explore
and can_write_ExploreFormDataRestAPI
to my Gamma role, and like you said my user was able to see the data but it was accompanied by an error message "There was an error loading the dataset metadata." Like you, I added that all_datasource_access
permission and the error went away - but that seems possibly overkill.
Bug description
When using Gamma role:
Permissions added to Gamma following: https://github.com/apache/superset/pull/27029
How to reproduce the bug
Create dashboard using admin role View dashboard using gamma role -> drill-by
Screenshots/recordings
No response
Superset version
4.0.2
Python version
3.11
Node version
16
Browser
Chrome
Additional context
No response
Checklist