mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 09:27:23 -05:00
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.
This commit is contained in:
@@ -9,6 +9,7 @@ from redash.models.parameterized_query import (
|
|||||||
QueryDetachedFromDataSourceError,
|
QueryDetachedFromDataSourceError,
|
||||||
)
|
)
|
||||||
from redash.monitor import rq_job_ids
|
from redash.monitor import rq_job_ids
|
||||||
|
from redash.query_runner import NotSupported
|
||||||
from redash.tasks.failure_report import track_failure
|
from redash.tasks.failure_report import track_failure
|
||||||
from redash.utils import json_dumps, sentry
|
from redash.utils import json_dumps, sentry
|
||||||
from redash.worker import get_job_logger, job
|
from redash.worker import get_job_logger, job
|
||||||
@@ -177,6 +178,8 @@ def refresh_schema(data_source_id):
|
|||||||
time.time() - start_time,
|
time.time() - start_time,
|
||||||
)
|
)
|
||||||
statsd_client.incr("refresh_schema.timeout")
|
statsd_client.incr("refresh_schema.timeout")
|
||||||
|
except NotSupported:
|
||||||
|
logger.debug("Datasource %s does not support schema refresh", ds.name)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.warning("Failed refreshing schema for the data source: %s", ds.name, exc_info=1)
|
logger.warning("Failed refreshing schema for the data source: %s", ds.name, exc_info=1)
|
||||||
statsd_client.incr("refresh_schema.error")
|
statsd_client.incr("refresh_schema.error")
|
||||||
|
|||||||
Reference in New Issue
Block a user