Skip to content

Commit 43ee21a

Browse files
authored
Feature/catch notsupported exception (#7573)
* Handle NotSupported exception in refresh_schema - Add NotSupported exception handling to refresh_schema() - Log unsupported datasources at DEBUG level - Avoid error metrics for datasources without schema support * Add test for NotSupported exception handling - Test that NotSupported exceptions are caught and logged at DEBUG level - Verify no warning logs are generated for unsupported datasources * Fix import order (ruff) * Remove test for NotSupported exception handling As suggested by @yoshiokatsuneo, testing logging details for 3 lines of code is excessive and may hurt maintainability. The existing tests already ensure the functionality works correctly.
1 parent 262d46f commit 43ee21a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

redash/tasks/queries/maintenance.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
QueryDetachedFromDataSourceError,
1010
)
1111
from redash.monitor import rq_job_ids
12+
from redash.query_runner import NotSupported
1213
from redash.tasks.failure_report import track_failure
1314
from redash.utils import json_dumps, sentry
1415
from redash.worker import get_job_logger, job
@@ -177,6 +178,8 @@ def refresh_schema(data_source_id):
177178
time.time() - start_time,
178179
)
179180
statsd_client.incr("refresh_schema.timeout")
181+
except NotSupported:
182+
logger.debug("Datasource %s does not support schema refresh", ds.name)
180183
except Exception:
181184
logger.warning("Failed refreshing schema for the data source: %s", ds.name, exc_info=1)
182185
statsd_client.incr("refresh_schema.error")

0 commit comments

Comments
 (0)