Feature/catch notsupported exception #7573
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Description
This PR implements an alternative approach to #7572 by catching
NotSupportedexceptions inrefresh_schema()instead of pre-filtering datasource types.Addresses issue #7571 - Clean up error logs from datasources that don't support schema refresh.
Motivation
As suggested by @yoshiokatsuneo in PR #7572 review, this approach is simpler and more maintainable:
Changes
NotSupportedexception handling torefresh_schema()Files changed:
redash/tasks/queries/maintenance.py: +3 lines (1 import, 2 exception handling)tests/tasks/test_refresh_schemas.py: +10 lines (1 test case)Flow Diagram
flowchart TD Start([refresh_schemas]) --> Loop{For each<br/>datasource} Loop -->|Paused| Skip1[Skip: paused] Loop -->|Active| Queue[Enqueue refresh_schema job] Queue --> Worker[Worker executes job] Worker --> Try[Try: ds.get_schema refresh=True] Try -->|Success| Success[Log: state=finished<br/>Increment: success metric] Try -->|JobTimeoutException| Timeout[Log: state=timeout<br/>Increment: timeout metric] Try -->|NotSupported| NotSupp[Log DEBUG: not supported<br/>No metric increment] Try -->|Other Exception| Error[Log WARNING: failed<br/>Increment: error metric] Success --> JobOK1[Job OK] Timeout --> JobOK2[Job OK] NotSupp --> JobOK3[Job OK] Error --> JobOK4[Job OK] Skip1 --> Loop JobOK1 --> Loop JobOK2 --> Loop JobOK3 --> Loop JobOK4 --> Loop Loop -->|Done| End([End]) style NotSupp fill:#2d5016,stroke:#4a7c2c,color:#fff style Success fill:#1e4d7b,stroke:#2e6da4,color:#fff style Error fill:#8b2e3b,stroke:#c9302c,color:#fff style Timeout fill:#8b6914,stroke:#d9a441,color:#fffKey Points:
How is this tested?
Unit Tests
Manual Testing
Tested with 3 datasources:
Worker logs (INFO level):
No error logs, all jobs completed successfully.
DEBUG Log Verification
When DEBUG level is enabled, unsupported datasources are logged:
Comparison with PR #7572
REDASH_SCHEMAS_REFRESH_EXCLUDED_TYPESBenefits
Log Output Behavior
Related Tickets & Documents
Mobile & Desktop Screenshots/Recordings (if there are UI changes)
N/A - Backend changes only