Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ingestion/tableau): human-readable message for PERMISSIONS_MODE_SWITCHED error #10866

Merged
Merged
32 changes: 28 additions & 4 deletions metadata-ingestion/src/datahub/ingestion/source/tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,10 +1009,34 @@ def get_connection_object_page(
error and (error.get(c.EXTENSIONS) or {}).get(c.SEVERITY) == c.WARNING
for error in errors
):
self.report.warning(
message=f"Received error fetching Query Connection {connection_type}",
context=f"Errors: {errors}",
)
# filter out PERMISSIONS_MODE_SWITCHED to report error in human-readable format
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are the PERMISSIONS_MODE_SWITCHED errors marked as severity = warning?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, below was the error message in report

{'message': 'One or more of the attributes used in your filter contain sensitive data so your results have been automatically filtered to contain only the results you have permissions to see', 'extensions': {'severity': 'WARNING', 'code': 'PERMISSIONS_MODE_SWITCHED', 'properties': {'workbooksConnection': ['projectNameWithin']}}}

other_errors = []
permission_mode_errors = []
for error in errors:
if (
error.get("extensions")
and errors["extensions"].get("code")
== "PERMISSIONS_MODE_SWITCHED"
):
permission_mode_errors.append(error)
else:
other_errors.append(error)

if other_errors:
self.report.warning(
message=f"Received error fetching Query Connection {connection_type}",
context=f"Errors: {other_errors}",
)

if permission_mode_errors:
self.report.warning(
title="Derived Permission Error",
message="Turn on your derived permissions. See for details "
"https://community.tableau.com/s/question/0D54T00000QnjHbSAJ/how-to-fix-the"
"-permissionsmodeswitched-error",
context=f"{permission_mode_errors}",
)

else:
raise RuntimeError(f"Query {connection_type} error: {errors}")

Expand Down
Loading